diff --git a/src/main/assembly/package.xml b/src/main/assembly/package.xml
new file mode 100644
index 00000000..c10a94c7
--- /dev/null
+++ b/src/main/assembly/package.xml
@@ -0,0 +1,40 @@
+
+
+ package
+
+ zip
+
+ false
+
+
+
+
+
+
+
+
+ src/main/conf
+ /
+
+
+ erp_web
+ /erp_web
+
+
+
+
+ src/main/resources/application.yml
+ /conf
+
+
+
+
+ lib
+ runtime
+
+
+
\ No newline at end of file
diff --git a/src/main/conf/jshERPStart.bat b/src/main/conf/jshERPStart.bat
new file mode 100644
index 00000000..8cc02bfa
--- /dev/null
+++ b/src/main/conf/jshERPStart.bat
@@ -0,0 +1,6 @@
+@echo off
+
+title jshERP
+
+java -Xms1000m -Xmx2000m -cp .\conf;.\lib\*; -XX:+CreateMinidumpOnCrash com.jsh.erp.ErpApplication
+pause over
\ No newline at end of file
diff --git a/src/main/conf/jshERPStart.sh b/src/main/conf/jshERPStart.sh
new file mode 100644
index 00000000..83f10e60
--- /dev/null
+++ b/src/main/conf/jshERPStart.sh
@@ -0,0 +1 @@
+java -XX:+CreateMinidumpOnCrash -cp ./conf:./lib/*: com.jsh.erp.ErpApplication
\ No newline at end of file
diff --git a/src/main/java/com/jsh/action/asset/AssetAction.java b/src/main/java/com/jsh/action/asset/AssetAction.java
deleted file mode 100644
index d543081c..00000000
--- a/src/main/java/com/jsh/action/asset/AssetAction.java
+++ /dev/null
@@ -1,452 +0,0 @@
-package com.jsh.action.asset;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.*;
-import com.jsh.model.vo.asset.AssetModel;
-import com.jsh.service.asset.AssetIService;
-import com.jsh.service.basic.AssetNameIService;
-import com.jsh.service.basic.CategoryIService;
-import com.jsh.service.basic.SupplierIService;
-import com.jsh.service.basic.UserIService;
-import com.jsh.util.AssetConstants;
-import com.jsh.util.JshException;
-import com.jsh.util.PageUtil;
-import com.jsh.util.Tools;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Timestamp;
-import java.text.ParseException;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@SuppressWarnings("serial")
-public class AssetAction extends BaseAction {
- private AssetModel model = new AssetModel();
- private AssetIService assetService;
- private CategoryIService categoryService;
- private SupplierIService supplierService;
- private UserIService userService;
- private AssetNameIService assetnameService;
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- public String getBasicData() {
- Map mapData = model.getShowModel().getMap();
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- try {
- Map condition = pageUtil.getAdvSearch();
- condition.put("id_s_order", "desc");
- categoryService.find(pageUtil);
- mapData.put("categoryList", pageUtil.getPageList());
- supplierService.find(pageUtil);
- mapData.put("supplierList", pageUtil.getPageList());
-
- condition.put("isystem_n_eq", 1);
- condition.put("id_s_order", "desc");
- userService.find(pageUtil);
- mapData.put("userList", pageUtil.getPageList());
-
- //清除搜索条件 防止对查询有影响
- condition.remove("isystem_n_eq");
-
- assetnameService.find(pageUtil);
- mapData.put("assetnameList", pageUtil.getPageList());
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
- model.getShowModel().setMsgTip("exceptoin");
- }
- return SUCCESS;
- }
-
- /**
- * 增加资产
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加资产方法===================");
- Boolean flag = false;
- try {
- Asset asset = new Asset();
- //添加设置
- asset.setAssetname(new Assetname(model.getAssetNameID()));
-
- asset.setLocation(model.getLocation());
- asset.setStatus(model.getStatus());
- asset.setPrice(model.getPrice());
-
- if (null != model.getUserID()) {
- asset.setUser(new Basicuser(model.getUserID()));
- }
- try {
- //购买日期
- asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime()));
- //有效日期
- asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime()));
- //保修日期
- asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime()));
- } catch (ParseException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
- }
-
- asset.setAssetnum(model.getAssetnum());
- asset.setSerialnum(model.getSerialnum());
- asset.setLabels(model.getLabels());
-
- asset.setSupplier(new Supplier(model.getSupplierID()));
- asset.setDescription(model.getDescription());
-
- asset.setCreatetime(new Timestamp(System.currentTimeMillis()));
- asset.setCreator(getUser());
- asset.setUpdatetime(new Timestamp(System.currentTimeMillis()));
- asset.setUpdator(getUser());
- asset.setAddMonth(Tools.getCurrentMonth());
- assetService.create(asset);
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加资产回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加资产", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "增加资产" + tipMsg));
- Log.infoFileSync("==================结束调用增加资产方法===================");
- }
-
- /**
- * 删除资产
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除资产信息方法delete()================");
- try {
- assetService.delete(model.getAssetID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetID() + " 的资产异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除资产", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除资产ID为 " + model.getAssetID() + " " + tipMsg + "!", "删除资产" + tipMsg));
- Log.infoFileSync("====================结束调用删除资产信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新资产
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Asset asset = assetService.get(model.getAssetID());
-
- //设置要更新的熟悉值
- asset.setAssetname(new Assetname(model.getAssetNameID()));
-
- asset.setLocation(model.getLocation());
- asset.setStatus(model.getStatus());
- asset.setPrice(model.getPrice());
-
- if (null != model.getUserID()) {
- asset.setUser(new Basicuser(model.getUserID()));
- } else {
- asset.setUser(null);
- }
- try {
- //购买日期
- asset.setPurchasedate(new Timestamp(Tools.parse(model.getPurchasedate(), "yyyy-MM-dd").getTime()));
- //有效日期
- asset.setPeriodofvalidity(new Timestamp(Tools.parse(model.getPeriodofvalidity(), "yyyy-MM-dd").getTime()));
- //保修日期
- asset.setWarrantydate(new Timestamp(Tools.parse(model.getWarrantydate(), "yyyy-MM-dd").getTime()));
- } catch (ParseException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e);
- }
-
- asset.setAssetnum(model.getAssetnum());
- asset.setSerialnum(model.getSerialnum());
- asset.setLabels(model.getLabels());
-
- asset.setSupplier(new Supplier(model.getSupplierID()));
- asset.setDescription(model.getDescription());
-
- asset.setUpdatetime(new Timestamp(System.currentTimeMillis()));
- asset.setUpdator(getUser());
- assetService.update(asset);
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改资产ID为 : " + model.getAssetID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改资产回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新资产", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新资产ID为 " + model.getAssetID() + " " + tipMsg + "!", "更新资产" + tipMsg));
- }
-
- /**
- * 批量删除指定ID资产
- *
- * @return
- */
- public String batchDelete() {
- try {
- assetService.batchDelete(model.getAssetIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除资产ID为:" + model.getAssetIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除资产", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除资产ID为 " + model.getAssetIDs() + " " + tipMsg + "!", "批量删除资产" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 查找资产信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- assetService.find(pageUtil);
-
- getSession().put("pageUtil", pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
-// {"total":28,"rows":[
-// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
-// ]}
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Asset asset : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", asset.getId());
- //添加资产属性
- item.put("assetname", asset.getAssetname().getAssetname());
- item.put("assetnameID", asset.getAssetname().getId());
- //单价
- item.put("price", Tools.dealNullStr(asset.getPrice() + ""));
- //分类
- item.put("category", asset.getAssetname().getCategory().getAssetname());
- item.put("categoryID", asset.getAssetname().getCategory().getId());
- //资产的状态:0==在库,1==在用,2==消费
- item.put("status", getStatusInfo(asset.getStatus()));
- item.put("statushort", asset.getStatus());
- //在用用户名称
- item.put("username", asset.getUser() == null ? "" : asset.getUser().getUsername());
- item.put("userID", asset.getUser() == null ? "" : asset.getUser().getId());
- //位置
- item.put("location", Tools.dealNullStr(asset.getLocation()));
-
- //购买日期
- item.put("purchasedate", asset.getPurchasedate() == null ? "" : Tools.getCurrentMonth(asset.getPurchasedate()));
- //有效日期
- item.put("periodofvalidity", asset.getPeriodofvalidity() == null ? "" : Tools.getCurrentMonth(asset.getPeriodofvalidity()));
- //保修日期
- item.put("warrantydate", asset.getWarrantydate() == null ? "" : Tools.getCurrentMonth(asset.getWarrantydate()));
- //资产编号
- item.put("assetnum", Tools.dealNullStr(asset.getAssetnum()));
- //资产序列号
- item.put("serialnum", Tools.dealNullStr(asset.getSerialnum()));
- //供应商
- item.put("supplier", asset.getSupplier() == null ? "" : asset.getSupplier().getSupplier());
- //供应商
- item.put("supplierID", asset.getSupplier() == null ? "" : asset.getSupplier().getId());
- //标签
- item.put("labels", Tools.dealNullStr(asset.getLabels()));
- item.put("description", Tools.dealNullStr(asset.getDescription()));
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找资产信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询资产信息结果异常", e);
- }
- }
-
- /**
- * 导出excel表格
- *
- * @return
- */
- @SuppressWarnings("unchecked")
- public String exportExcel() {
- Log.infoFileSync("===================调用导出资产信息action方法exportExcel开始=======================");
- try {
- PageUtil pageUtil = (PageUtil) getSession().get("pageUtil");
-
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- //pageUtil.setAdvSearch(getCondition());
- String isCurrentPage = model.getIsAllData();
- model.setFileName(Tools.changeUnicode(model.getFileName() + ".xls", model.getBrowserType()));
- model.setExcelStream(assetService.exmportExcel(isCurrentPage, pageUtil));
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出资产信息action方法exportExcel异常", e);
- model.getShowModel().setMsgTip("export excel exception");
- }
- Log.infoFileSync("===================调用导出资产信息action方法exportExcel结束==================");
- return AssetConstants.BusinessForExcel.EXCEL;
- }
-
-
- /**
- * 导入资产excel表格内容
- */
- public String importExcel() {
- //资产excel表格file
- Boolean result = false;
- String returnStr = "";
- try {
- InputStream in = assetService.importExcel(model.getAssetFile(), model.getIsCheck());
-
- if (null != in) {
- model.setFileName(Tools.getRandomChar() + Tools.getNow2(Calendar.getInstance().getTime()) + "_wrong.xls");
- model.setExcelStream(in);
- returnStr = AssetConstants.BusinessForExcel.EXCEL;
- } else {
- result = true;
- try {
- toClient(result.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写导入资产信息结果异常", e);
- }
- //导入数据成功
- returnStr = SUCCESS;
- }
-
- } catch (JshException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>导入excel表格信息异常", e);
- }
- return returnStr;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("assetname.id_n_eq", model.getAssetNameID());
- condition.put("assetname.category.id_n_eq", model.getAssetCategoryID());
- condition.put("user.id_n_eq", model.getUserID());
- condition.put("status_n_eq", model.getStatus());
- condition.put("supplier.id_n_eq", model.getSupplierID());
- condition.put("createtime_s_order", "desc");
- return condition;
- }
-
- /**
- * 根据状态码转化成说明字符串
- * 资产的状态:0==在库,1==在用,2==消费
- *
- * @param statusCode
- * @return
- */
- private String getStatusInfo(short statusCode) {
- String statusInfo = "";
- switch (statusCode) {
- case AssetConstants.BusinessForExcel.EXCEl_STATUS_ZAIKU:
- statusInfo = "在库";
- break;
-
- case AssetConstants.BusinessForExcel.EXCEl_STATUS_INUSE:
- statusInfo = "在用";
- break;
-
- case AssetConstants.BusinessForExcel.EXCEl_STATUS_CONSUME:
- statusInfo = "消费";
- break;
- default:
- break;
- }
- return statusInfo;
- }
-
- //=========Spring注入以及model驱动公共方法===========
- public void setAssetService(AssetIService assetService) {
- this.assetService = assetService;
- }
-
- public void setCategoryService(CategoryIService categoryService) {
- this.categoryService = categoryService;
- }
-
- public void setSupplierService(SupplierIService supplierService) {
- this.supplierService = supplierService;
- }
-
- public void setUserService(UserIService userService) {
- this.userService = userService;
- }
-
- public void setAssetnameService(AssetNameIService assetnameService) {
- this.assetnameService = assetnameService;
- }
-
- @Override
- public AssetModel getModel() {
- return model;
- }
-}
diff --git a/src/main/java/com/jsh/action/asset/ReportAction.java b/src/main/java/com/jsh/action/asset/ReportAction.java
deleted file mode 100644
index 6e1dff86..00000000
--- a/src/main/java/com/jsh/action/asset/ReportAction.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.jsh.action.asset;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Asset;
-import com.jsh.model.vo.asset.ReportModel;
-import com.jsh.service.asset.ReportIService;
-import com.jsh.util.JshException;
-import com.jsh.util.PageUtil;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@SuppressWarnings("serial")
-public class ReportAction extends BaseAction {
- private ReportModel model = new ReportModel();
- private ReportIService reportService;
-
- /**
- * 查找资产信息
- *
- * @return
- */
- public String find() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition());
- String reportType = getReportType(new HashMap());
- reportService.find(pageUtil, reportType.split("_")[0], reportType.split("_")[1]);
- model.getShowModel().setReportData(pageUtil.getPageList());
- } catch (JshException e) {
- Log.errorFileSync(">>>>>>>>>查找资产信息异常", e);
- model.getShowModel().setMsgTip("get report data exception");
- }
- return SUCCESS;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("assetname.id_n_eq", model.getAssetNameID());
- condition.put("assetname.category.id_n_eq", model.getAssetCategoryID());
- condition.put("user.id_n_eq", model.getUsernameID());
- condition.put("status_n_eq", model.getStatus());
- condition.put("supplier.id_n_eq", model.getSupplierID());
- condition.put("dataSum_s_order", "desc");
- //拼接统计数据条件
- getReportType(condition);
- return condition;
- }
-
- /**
- * 获取统计条件
- *
- * @param condition
- */
- private String getReportType(Map condition) {
-//
-//
-//
-//
-//
- int reportType = model.getReportType();
- String reportTypeInfo = "";
- String reportTypeName = "";
- switch (reportType) {
- case 0:
- condition.put("status_s_gb", "group");
- reportTypeInfo = "status";
- reportTypeName = "status";
- break;
- case 1:
- condition.put("assetname.category.id_s_gb", "group");
- reportTypeInfo = "assetname.category.id";
- reportTypeName = "assetname.category.assetname";
- break;
- case 2:
- condition.put("supplier.id_s_gb", "group");
- reportTypeInfo = "supplier.id";
- reportTypeName = "supplier.supplier";
- break;
- case 3:
- condition.put("assetname.id_s_gb", "group");
- reportTypeInfo = "assetname.id";
- reportTypeName = "assetname.assetname";
- break;
- case 4:
- condition.put("user.id_s_gb", "group");
- reportTypeInfo = "user.id";
- reportTypeName = "user.username";
- break;
- default:
- break;
- }
- return reportTypeInfo + "_" + reportTypeName;
- }
-
- //=========Spring注入以及model驱动公共方法===========
- public void setReportService(ReportIService reportService) {
- this.reportService = reportService;
- }
-
- @Override
- public ReportModel getModel() {
- return model;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/AccountAction.java b/src/main/java/com/jsh/action/basic/AccountAction.java
deleted file mode 100644
index cc7636b7..00000000
--- a/src/main/java/com/jsh/action/basic/AccountAction.java
+++ /dev/null
@@ -1,683 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.*;
-import com.jsh.model.vo.basic.AccountModel;
-import com.jsh.service.basic.AccountIService;
-import com.jsh.service.materials.AccountHeadIService;
-import com.jsh.service.materials.AccountItemIService;
-import com.jsh.service.materials.DepotHeadIService;
-import com.jsh.util.JshException;
-import com.jsh.util.PageUtil;
-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.text.DecimalFormat;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 结算账户
- *
- * @author ji sheng hua qq7527-18920
- */
-@SuppressWarnings("serial")
-public class AccountAction extends BaseAction {
- private AccountIService accountService;
- private DepotHeadIService depotHeadService;
- private AccountHeadIService accountHeadService;
- private AccountItemIService accountItemService;
- private AccountModel model = new AccountModel();
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- public String getAccount() {
- Map mapData = model.getShowModel().getMap();
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- try {
- Map condition = pageUtil.getAdvSearch();
- condition.put("Id_s_order", "asc");
- accountService.find(pageUtil);
- mapData.put("accountList", pageUtil.getPageList());
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>查找账户信息异常", e);
- model.getShowModel().setMsgTip("exception");
- }
- return SUCCESS;
- }
-
- /**
- * 增加结算账户
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加结算账户方法===================");
- Boolean flag = false;
- try {
- Account Account = new Account();
- Account.setName(model.getName());
- Account.setSerialNo(model.getSerialNo());
- Account.setInitialAmount(model.getInitialAmount() != null ? model.getInitialAmount() : 0);
- Account.setCurrentAmount(model.getCurrentAmount());
- Account.setRemark(model.getRemark());
- accountService.create(Account);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加结算账户异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加结算账户回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加结算账户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加结算账户名称为 " + model.getName() + " " + tipMsg + "!", "增加结算账户" + tipMsg));
- Log.infoFileSync("==================结束调用增加结算账户方法===================");
- }
-
- /**
- * 删除结算账户
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除结算账户信息方法delete()================");
- try {
- accountService.delete(model.getAccountID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAccountID() + " 的结算账户异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除结算账户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除结算账户ID为 " + model.getAccountID() + ",名称为 " + model.getName() + tipMsg + "!", "删除结算账户" + tipMsg));
- Log.infoFileSync("====================结束调用删除结算账户信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新结算账户
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Account Account = accountService.get(model.getAccountID());
- Account.setName(model.getName());
- Account.setSerialNo(model.getSerialNo());
- Account.setInitialAmount(model.getInitialAmount() != null ? model.getInitialAmount() : 0);
- Account.setCurrentAmount(model.getCurrentAmount());
- Account.setRemark(model.getRemark());
- accountService.update(Account);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改结算账户ID为 : " + model.getAccountID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改结算账户回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新结算账户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新结算账户ID为 " + model.getAccountID() + " " + tipMsg + "!", "更新结算账户" + tipMsg));
- }
-
- /**
- * 更新结算账户金额
- *
- * @return
- */
- public void updateAmount() {
- Boolean flag = false;
- try {
- Account Account = accountService.get(model.getAccountID());
- Account.setCurrentAmount(model.getCurrentAmount());
- accountService.update(Account);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改结算账户ID为 : " + model.getAccountID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改结算账户回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新结算账户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新结算账户ID为 " + model.getAccountID() + " " + tipMsg + "!", "更新结算账户" + tipMsg));
- }
-
- /**
- * 更新结算账户-设置是否默认
- *
- * @return
- */
- public void updateAmountIsDefault() {
- Boolean flag = false;
- try {
- Account Account = accountService.get(model.getAccountID());
- Account.setIsDefault(model.getIsDefault());
- accountService.update(Account);
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改结算账户ID为 : " + model.getAccountID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改结算账户回写客户端结果异常", e);
- }
- }
- //如果改为默认账户时记录日志
- if (model.getIsDefault()) {
- logService.create(new Logdetails(getUser(), "更新默认账户", model.getClientIp(), new Timestamp(System.currentTimeMillis()),
- tipType, "更新账户ID" + model.getAccountID() + "为默认账户" + tipMsg + "!", "更新默认账户" + tipMsg));
- }
- }
-
- /**
- * 批量删除指定ID结算账户
- *
- * @return
- */
- public String batchDelete() {
- try {
- accountService.batchDelete(model.getAccountIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除结算账户ID为:" + model.getAccountIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除结算账户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除结算账户ID为 " + model.getAccountIDs() + " " + tipMsg + "!", "批量删除结算账户" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = accountService.checkIsNameExist("name", model.getName(), "id", model.getAccountID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查结算账户名称为:" + model.getName() + " ID为: " + model.getAccountID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查结算账户名称为:" + model.getName() + " ID为: " + model.getAccountID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找结算账户信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- accountService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Account account : dataList) {
- DecimalFormat df = new DecimalFormat(".##");
- JSONObject item = new JSONObject();
- item.put("id", account.getId());
- //结算账户名称
- item.put("name", account.getName());
- item.put("serialNo", account.getSerialNo());
- item.put("initialAmount", account.getInitialAmount());
- String timeStr = Tools.getCurrentMonth();
- Double thisMonthAmount = getAccountSum(account.getId(), timeStr, "month") + getAccountSumByHead(account.getId(), timeStr, "month") + getAccountSumByDetail(account.getId(), timeStr, "month") + getManyAccountSum(account.getId(), timeStr, "month");
- String thisMonthAmountFmt = "0";
- if (thisMonthAmount != 0) {
- thisMonthAmountFmt = df.format(thisMonthAmount);
- }
- item.put("thisMonthAmount", thisMonthAmountFmt); //本月发生额
- Double currentAmount = getAccountSum(account.getId(), "", "month") + getAccountSumByHead(account.getId(), "", "month") + getAccountSumByDetail(account.getId(), "", "month") + getManyAccountSum(account.getId(), "", "month") + account.getInitialAmount();
- String currentAmountFmt = df.format(currentAmount);
- item.put("currentAmount", currentAmountFmt); //当前余额
- item.put("isDefault", account.getIsDefault()); //是否默认
- item.put("remark", account.getRemark());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找结算账户信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询结算账户信息结果异常", e);
- }
- }
-
- /**
- * 单个账户的金额求和-入库和出库
- *
- * @param id
- * @return
- */
- public Double getAccountSum(Long id, String timeStr, String type) {
- Double accountSum = 0.0;
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_getSum(id, timeStr, type));
- depotHeadService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- if (dataList != null) {
- for (DepotHead depotHead : dataList) {
- accountSum = accountSum + depotHead.getChangeAmount();
- }
- }
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找进销存信息异常", e);
- }
- return accountSum;
- }
-
- /**
- * 单个账户的金额求和-收入、支出、转账的单据表头的合计
- *
- * @param id
- * @return
- */
- public Double getAccountSumByHead(Long id, String timeStr, String type) {
- Double accountSum = 0.0;
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_getSumByHead(id, timeStr, type));
- accountHeadService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- if (dataList != null) {
- for (AccountHead accountHead : dataList) {
- accountSum = accountSum + accountHead.getChangeAmount();
- }
- }
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找进销存信息异常", e);
- }
- return accountSum;
- }
-
- /**
- * 单个账户的金额求和-收款、付款、转账、收预付款的单据明细的合计
- *
- * @param id
- * @return
- */
- public Double getAccountSumByDetail(Long id, String timeStr, String type) {
- Double accountSum = 0.0;
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_getSumByHead(timeStr, type));
- accountHeadService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- if (dataList != null) {
- String ids = "";
- for (AccountHead accountHead : dataList) {
- ids = ids + accountHead.getId() + ",";
- }
- if (!ids.equals("")) {
- ids = ids.substring(0, ids.length() - 1);
- }
- PageUtil pageUtilOne = new PageUtil();
- pageUtilOne.setPageSize(0);
- pageUtilOne.setCurPage(0);
- pageUtilOne.setAdvSearch(getCondition_getSumByDetail(id, ids));
- accountItemService.find(pageUtilOne);
- List dataListOne = pageUtilOne.getPageList();
- if (dataListOne != null) {
- for (AccountItem accountItem : dataListOne) {
- accountSum = accountSum + accountItem.getEachAmount();
- }
- }
- }
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找进销存信息异常", e);
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>异常信息:", e);
- }
- return accountSum;
- }
-
- /**
- * 单个账户的金额求和-多账户的明细合计
- *
- * @param id
- * @return
- */
- public Double getManyAccountSum(Long id, String timeStr, String type) {
- Double accountSum = 0.0;
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_getManyAccountSum(id, timeStr, type));
- depotHeadService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- if (dataList != null) {
- for (DepotHead depotHead : dataList) {
- String accountIdList = depotHead.getAccountIdList();
- String accountMoneyList = depotHead.getAccountMoneyList();
- accountIdList = accountIdList.replace("[", "").replace("]", "").replace("\"", "");
- accountMoneyList = accountMoneyList.replace("[", "").replace("]", "").replace("\"", "");
- String[] aList = accountIdList.split(",");
- String[] amList = accountMoneyList.split(",");
- for (int i = 0; i < aList.length; i++) {
- if (aList[i].toString().equals(id.toString())) {
- accountSum = accountSum + Double.parseDouble(amList[i].toString());
- }
- }
- }
- }
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找信息异常", e);
- }
- return accountSum;
- }
-
- /**
- * 查找结算账户信息-下拉框
- *
- * @return
- */
- public void findBySelect() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_select());
- accountService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Account account : dataList) {
- JSONObject item = new JSONObject();
- item.put("Id", account.getId());
- //结算账户名称
- item.put("AccountName", account.getName());
- dataArray.add(item);
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找结算账户信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询结算账户信息结果异常", e);
- }
- }
-
- /**
- * 账户流水信息
- */
- public void findAccountInOutList() {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- Long accountId = model.getAccountID();
- Double initialAmount = model.getInitialAmount();
- try {
- accountService.findAccountInOutList(pageUtil, accountId);
- List dataList = pageUtil.getPageList();
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (dataList != null) {
- for (Integer i = 0; i < dataList.size(); i++) {
- JSONObject item = new JSONObject();
- Object dl = dataList.get(i); //获取对象
- Object[] arr = (Object[]) dl; //转为数组
- item.put("number", arr[0]); //单据编号
- item.put("type", arr[1]); //类型
- item.put("supplierName", arr[2]); //单位信息
- item.put("changeAmount", arr[3]); //金额
- String timeStr = arr[4].toString();
- Double balance = getAccountSum(accountId, timeStr, "date") + getAccountSumByHead(accountId, timeStr, "date")
- + getAccountSumByDetail(accountId, timeStr, "date") + getManyAccountSum(accountId, timeStr, "date") + initialAmount;
- item.put("balance", balance); //余额
- item.put("operTime", arr[4]); //入库出库日期
- item.put("aList", arr[5]); //多账户的id列表
- item.put("amList", arr[6]); //多账户的金额列表
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (JshException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("name_s_like", model.getName());
- condition.put("serialNo_s_like", model.getSerialNo());
- condition.put("remark_s_like", model.getRemark());
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-下拉框-结算账户
- *
- * @return
- */
- private Map getCondition_select() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition_getSum(Long id, String timeStr, String type) {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("AccountId_n_eq", id);
- condition.put("PayType_s_neq", "预付款");
- if (!timeStr.equals("")) {
- if (type.equals("month")) {
- condition.put("OperTime_s_gteq", timeStr + "-01 00:00:00");
- condition.put("OperTime_s_lteq", timeStr + "-31 00:00:00");
- } else if (type.equals("date")) {
- condition.put("OperTime_s_lteq", timeStr);
- }
- }
- return condition;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition_getManyAccountSum(Long id, String timeStr, String type) {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("AccountIdList_s_like", "\"" + id.toString() + "\"");
- if (!timeStr.equals("")) {
- if (type.equals("month")) {
- condition.put("OperTime_s_gteq", timeStr + "-01 00:00:00");
- condition.put("OperTime_s_lteq", timeStr + "-31 00:00:00");
- } else if (type.equals("date")) {
- condition.put("OperTime_s_lteq", timeStr);
- }
- }
- return condition;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition_getSumByHead(Long id, String timeStr, String type) {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("AccountId_n_eq", id);
- if (!timeStr.equals("")) {
- if (type.equals("month")) {
- condition.put("BillTime_s_gteq", timeStr + "-01 00:00:00");
- condition.put("BillTime_s_lteq", timeStr + "-31 00:00:00");
- } else if (type.equals("date")) {
- condition.put("BillTime_s_lteq", timeStr);
- }
- }
- return condition;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition_getSumByHead(String timeStr, String type) {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- if (!timeStr.equals("")) {
- if (type.equals("month")) {
- condition.put("BillTime_s_gteq", timeStr + "-01 00:00:00");
- condition.put("BillTime_s_lteq", timeStr + "-31 00:00:00");
- } else if (type.equals("date")) {
- condition.put("BillTime_s_lteq", timeStr);
- }
- }
- return condition;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition_getSumByDetail(Long id, String ids) {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("AccountId_n_eq", id);
- if (!ids.equals("")) {
- condition.put("HeaderId_s_in", ids);
- }
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public AccountModel getModel() {
- return model;
- }
-
- public void setAccountService(AccountIService accountService) {
- this.accountService = accountService;
- }
-
- public void setDepotHeadService(DepotHeadIService depotHeadService) {
- this.depotHeadService = depotHeadService;
- }
-
- public void setAccountHeadService(AccountHeadIService accountHeadService) {
- this.accountHeadService = accountHeadService;
- }
-
- public void setAccountItemService(AccountItemIService accountItemService) {
- this.accountItemService = accountItemService;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/AppAction.java b/src/main/java/com/jsh/action/basic/AppAction.java
deleted file mode 100644
index 71d623bf..00000000
--- a/src/main/java/com/jsh/action/basic/AppAction.java
+++ /dev/null
@@ -1,482 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.App;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.vo.basic.AppModel;
-import com.jsh.service.basic.AppIService;
-import com.jsh.service.basic.UserBusinessIService;
-import com.jsh.util.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
- */
-@SuppressWarnings("serial")
-public class AppAction extends BaseAction {
- private AppIService appService;
- private UserBusinessIService userBusinessService;
- private AppModel model = new AppModel();
-
- /**
- * 上传图片
- */
- public void uploadImg() {
- Log.infoFileSync("==================开始调用上传图片方法uploadImg()===================");
- File fileInfo = model.getFileInfo();
- String fileName = model.getFileInfoName(); //获取文件名
- try {
- if (fileInfo != null) {
- String path = ServletActionContext.getServletContext().getRealPath("/upload/images/deskIcon");
- InputStream is = new FileInputStream(fileInfo);
- File file = new File(path, fileName);
- OutputStream os = new FileOutputStream(file);
- byte[] b = new byte[1024];
- int bs = 0;
- while ((bs = is.read(b)) > 0) {
- os.write(b, 0, bs);
- }
- is.close();
- os.close();
- }
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- // e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- // e.printStackTrace();
- }
- Log.infoFileSync("==================结束调用上传图片方法uploadImg()===================");
- }
-
- /**
- * 增加应用
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加应用方法create()===================");
- Boolean flag = false;
- try {
- App app = new App();
- app.setNumber(model.getNumber());
- app.setName(model.getName());
- app.setType(model.getType());
- app.setIcon(model.getIcon()); //设置图片Icon
- app.setURL(model.getURL());
- app.setWidth(model.getWidth());
- app.setHeight(model.getHeight());
- app.setReSize(model.getReSize());
- app.setOpenMax(model.getOpenMax());
- app.setFlash(model.getFlash());
- app.setZL(model.getZL());
- app.setSort(model.getSort());
- app.setRemark(model.getRemark());
- app.setEnabled(model.getEnabled());
- appService.create(app);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加应用异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加应用回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加应用", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加应用名称为 " + model.getName() + " " + tipMsg + "!", "增加应用" + tipMsg));
- Log.infoFileSync("==================结束调用增加应用方法create()===================");
- }
-
- /**
- * 删除应用
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除应用方法delete()================");
- try {
- appService.delete(model.getAppID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAppID() + " 的应用异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除应用", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除应用ID为 " + model.getAppID() + " " + tipMsg + "!", "删除应用" + tipMsg));
- Log.infoFileSync("====================结束调用删除应用方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新仓库
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- App app = appService.get(model.getAppID());
- app.setNumber(model.getNumber());
- app.setName(model.getName());
- app.setType(model.getType());
- //app.setIcon(model.getIcon());
- app.setURL(model.getURL());
- app.setWidth(model.getWidth());
- app.setHeight(model.getHeight());
- app.setReSize(model.getReSize());
- app.setOpenMax(model.getOpenMax());
- app.setFlash(model.getFlash());
- app.setZL(model.getZL());
- app.setSort(model.getSort());
- app.setRemark(model.getRemark());
- app.setEnabled(model.getEnabled());
- appService.update(app);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改应用ID为 : " + model.getAppID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改应用回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新应用", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新应用ID为 " + model.getAppID() + " " + tipMsg + "!", "更新应用" + tipMsg));
- }
-
- /**
- * 批量删除指定ID应用
- *
- * @return
- */
- public String batchDelete() {
- try {
- appService.batchDelete(model.getAppIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除应用ID为:" + model.getAppIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除应用", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除应用ID为 " + model.getAppIDs() + " " + tipMsg + "!", "批量删除应用" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = appService.checkIsNameExist("name", model.getName(), "Id", model.getAppID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找应用信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- appService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
-// {"total":28,"rows":[
-// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
-// ]}
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (App app : dataList) {
- JSONObject item = new JSONObject();
- item.put("Id", app.getId());
- //应用名称
- item.put("Number", app.getNumber());
- item.put("Name", app.getName());
- item.put("Type", app.getType());
- item.put("Icon", app.getIcon());
- item.put("URL", app.getURL());
- item.put("Width", app.getWidth());
- item.put("Height", app.getHeight());
- item.put("ReSize", app.getReSize());
- item.put("OpenMax", app.getOpenMax());
- item.put("Flash", app.getFlash());
- item.put("ZL", app.getZL());
- item.put("Sort", app.getSort());
- item.put("Remark", app.getRemark());
- item.put("Enabled", app.getEnabled());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
- }
- }
-
- /**
- * 桌面应用显示
- *
- * @return
- */
- public void findDesk() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(100);
- //pageUtil.setCurPage(model.getPageNo());
-
- JSONObject outer = new JSONObject();
-
- //下面是dock
- pageUtil.setAdvSearch(getCondition_dock());
- appService.find(pageUtil);
- List dataList1 = pageUtil.getPageList();
-
- //开始拼接json数据
- //存放数据json数组
- JSONArray dataArray1 = new JSONArray();
- if (null != dataList1) {
- for (App app : dataList1) {
- JSONObject item = new JSONObject();
- item.put("id", app.getId());
- item.put("title", app.getName());
- item.put("type", app.getType());
- item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
- item.put("url", app.getURL());
- item.put("width", app.getWidth());
- item.put("height", app.getHeight());
- item.put("isresize", app.getReSize());
- item.put("isopenmax", app.getOpenMax());
- item.put("isflash", app.getFlash());
- dataArray1.add(item);
- }
- }
- outer.put("dock", dataArray1);
-
- //下面是desk
- pageUtil.setAdvSearch(getCondition_desk());
- appService.find(pageUtil);
- List dataList2 = pageUtil.getPageList();
-
- //开始拼接json数据
- //存放数据json数组
- JSONArray dataArray2 = new JSONArray();
- if (null != dataList2) {
- for (App app : dataList2) {
- JSONObject item = new JSONObject();
- item.put("id", app.getId());
- item.put("title", app.getName());
- item.put("type", app.getType());
- item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
- item.put("url", "../../pages/common/menu.jsp?appID=" + app.getNumber() + "&id=" + app.getId());
- item.put("width", app.getWidth());
- item.put("height", app.getHeight());
- item.put("isresize", app.getReSize());
- item.put("isopenmax", app.getOpenMax());
- item.put("isflash", app.getFlash());
- dataArray2.add(item);
- }
- }
- outer.put("desk", dataArray2);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
- }
- }
-
-
- /**
- * 角色对应应用显示
- *
- * @return
- */
- public void findRoleAPP() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(100);
- //pageUtil.setCurPage(model.getPageNo());
-
- pageUtil.setAdvSearch(getCondition_RoleAPP());
- appService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
- JSONObject outer = new JSONObject();
- outer.put("id", 1);
- outer.put("text", "应用列表");
- outer.put("state", "open");
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (App app : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", app.getId());
- item.put("text", app.getName());
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + app.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item.put("checked", true);
- }
- //结束
- dataArray.add(item);
- }
- }
- outer.put("children", dataArray);
- //回写查询结果
- toClient("[" + outer.toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("Name_s_like", model.getName());
- condition.put("Type_s_like", model.getType());
- condition.put("Sort_s_order", "asc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-桌面dock
- *
- * @return
- */
- private Map getCondition_dock() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("ZL_s_eq", "dock");
- condition.put("Enabled_n_eq", 1);
- condition.put("Sort_s_order", "asc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-桌面desk
- *
- * @return
- */
- private Map getCondition_desk() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("ZL_s_eq", "desk");
- condition.put("Enabled_n_eq", 1);
- condition.put("Sort_s_order", "asc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-角色对应应用
- *
- * @return
- */
- private Map getCondition_RoleAPP() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("Enabled_n_eq", 1);
- condition.put("Sort_s_order", "asc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public AppModel getModel() {
- return model;
- }
-
- public void setAppService(AppIService appService) {
- this.appService = appService;
- }
-
- public void setUserBusinessService(UserBusinessIService userBusinessService) {
- this.userBusinessService = userBusinessService;
- }
-
-}
diff --git a/src/main/java/com/jsh/action/basic/AssetNameAction.java b/src/main/java/com/jsh/action/basic/AssetNameAction.java
deleted file mode 100644
index 30ba0b58..00000000
--- a/src/main/java/com/jsh/action/basic/AssetNameAction.java
+++ /dev/null
@@ -1,247 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Assetname;
-import com.jsh.model.po.Category;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.vo.basic.AssetNameModel;
-import com.jsh.service.basic.AssetNameIService;
-import com.jsh.util.PageUtil;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@SuppressWarnings("serial")
-public class AssetNameAction extends BaseAction {
- private AssetNameModel model = new AssetNameModel();
-
- private AssetNameIService assetnameService;
-
- /**
- * 增加资产名称
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加资产名称方法create()===================");
- Boolean flag = false;
- try {
- Assetname assetname = new Assetname();
- assetname.setAssetname(model.getAssetName());
- //增加资产类型
- assetname.setCategory(new Category(model.getCategoryID()));
-
- assetname.setIsystem((short) 1);
- assetname.setIsconsumables(model.getConsumable());
- assetname.setDescription(model.getDescription());
- assetnameService.create(assetname);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产名称异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加资产名称回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加资产名称", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加资产名称名称为 " + model.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg));
- Log.infoFileSync("==================结束调用增加资产名称方法create()===================");
- }
-
- /**
- * 删除资产名称
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================");
- try {
- assetnameService.delete(model.getAssetNameID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg));
- Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新资产名称
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Assetname assetname = assetnameService.get(model.getAssetNameID());
- //增加资产类型
- assetname.setCategory(new Category(model.getCategoryID()));
- assetname.setAssetname(model.getAssetName());
- assetname.setIsconsumables(model.getConsumable());
- assetname.setDescription(model.getDescription());
- assetnameService.update(assetname);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改资产名称ID为 : " + model.getAssetNameID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改资产名称回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新资产名称", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg));
- }
-
- /**
- * 批量删除指定ID资产名称
- *
- * @return
- */
- public String batchDelete() {
- try {
- assetnameService.batchDelete(model.getAssetNameIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除资产名称ID为:" + model.getAssetNameIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除资产名称", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除资产名称ID为 " + model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = assetnameService.checkIsNameExist("assetname", model.getAssetName(), "id", model.getAssetNameID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找供应商信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- assetnameService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
-// {"total":28,"rows":[
-// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
-// ]}
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Assetname assetname : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", assetname.getId());
- //供应商名称
- item.put("assetname", assetname.getAssetname());
- item.put("isystem", assetname.getIsystem() == (short) 0 ? "是" : "否");
- item.put("consumable", assetname.getIsconsumables() == (short) 0 ? "是" : "否");
- item.put("consumableStatus", assetname.getIsconsumables());
- item.put("description", assetname.getDescription());
- item.put("categoryID", assetname.getCategory().getId());
- item.put("category", assetname.getCategory().getAssetname());
- item.put("op", assetname.getIsystem());
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产名称信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产名称信息结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("assetname_s_like", model.getAssetName());
- condition.put("isconsumables_n_eq", model.getConsumable());
- condition.put("description_s_like", model.getDescription());
- condition.put("category.id_n_eq", model.getCategoryID());
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public AssetNameModel getModel() {
- return model;
- }
-
- public void setAssetnameService(AssetNameIService assetnameService) {
- this.assetnameService = assetnameService;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/CategoryAction.java b/src/main/java/com/jsh/action/basic/CategoryAction.java
deleted file mode 100644
index b1dd5c5e..00000000
--- a/src/main/java/com/jsh/action/basic/CategoryAction.java
+++ /dev/null
@@ -1,235 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Category;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.vo.basic.CategoryModel;
-import com.jsh.service.basic.CategoryIService;
-import com.jsh.util.PageUtil;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/*
- * @author jishenghua qq:7-5-2-7-1-8-9-2-0
- */
-@SuppressWarnings("serial")
-public class CategoryAction extends BaseAction {
- private CategoryIService categoryService;
- private CategoryModel model = new CategoryModel();
-
- /**
- * 增加资产类型
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加资产类型方法create()===================");
- Boolean flag = false;
- try {
- Category category = new Category();
- category.setAssetname(model.getCategoryName());
- category.setIsystem((short) 1);
- category.setDescription(model.getDescription());
- categoryService.create(category);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产类型异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加资产类型回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加资产类型", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加资产类型名称为 " + model.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg));
- Log.infoFileSync("==================结束调用增加资产类型方法create()===================");
- }
-
- /**
- * 删除资产类型
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================");
- try {
- categoryService.delete(model.getCategoryID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除资产类型ID为 " + model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg));
- Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新资产类型
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Category category = categoryService.get(model.getCategoryID());
- category.setAssetname(model.getCategoryName());
- category.setDescription(model.getDescription());
- categoryService.update(category);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改资产类型ID为 : " + model.getCategoryID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改资产类型回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新资产类型", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新资产类型ID为 " + model.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg));
- }
-
- /**
- * 批量删除指定ID资产类型
- *
- * @return
- */
- public String batchDelete() {
- try {
- categoryService.batchDelete(model.getCategoryIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除资产类型ID为 " + model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = categoryService.checkIsNameExist("assetname", model.getCategoryName(), "id", model.getCategoryID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找供应商信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- categoryService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
-// {"total":28,"rows":[
-// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
-// ]}
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Category category : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", category.getId());
- //供应商名称
- item.put("categoryname", category.getAssetname());
- item.put("isystem", category.getIsystem() == (short) 0 ? "是" : "否");
- item.put("description", category.getDescription());
- item.put("op", category.getIsystem());
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产类型信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产类型信息结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("assetname_s_like", model.getCategoryName());
- condition.put("description_s_like", model.getDescription());
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public CategoryModel getModel() {
- return model;
- }
-
- public void setCategoryService(CategoryIService categoryService) {
- this.categoryService = categoryService;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/DepotAction.java b/src/main/java/com/jsh/action/basic/DepotAction.java
deleted file mode 100644
index fcb636f9..00000000
--- a/src/main/java/com/jsh/action/basic/DepotAction.java
+++ /dev/null
@@ -1,429 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Depot;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.vo.basic.DepotModel;
-import com.jsh.service.basic.DepotIService;
-import com.jsh.service.basic.UserBusinessIService;
-import com.jsh.util.PageUtil;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 仓库管理
- *
- * @author jishenghua qq:7-5-2-7-1-8-9-2-0
- */
-@SuppressWarnings("serial")
-public class DepotAction extends BaseAction {
- private DepotIService depotService;
- private UserBusinessIService userBusinessService;
- private DepotModel model = new DepotModel();
-
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- public String getBasicData() {
- Map mapData = model.getShowModel().getMap();
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- try {
- Map condition = pageUtil.getAdvSearch();
- condition.put("sort_s_order", "asc");
- depotService.find(pageUtil);
- mapData.put("depotList", pageUtil.getPageList());
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
- model.getShowModel().setMsgTip("exceptoin");
- }
- return SUCCESS;
- }
-
- /**
- * 增加仓库
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加仓库信息方法create()===================");
- Boolean flag = false;
- try {
- Depot depot = new Depot();
- depot.setName(model.getName());
- depot.setAddress(model.getAddress());
- depot.setWarehousing(model.getWarehousing());
- depot.setTruckage(model.getTruckage());
- depot.setType(model.getType());
- depot.setSort(model.getSort());
- depot.setRemark(model.getRemark());
- depotService.create(depot);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓库信息异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加仓库信息回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加仓库", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加仓库名称为 " + model.getName() + " " + tipMsg + "!", "增加仓库" + tipMsg));
- Log.infoFileSync("==================结束调用增加仓库方法create()===================");
- }
-
- /**
- * 删除仓库
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除仓库信息方法delete()================");
- try {
- depotService.delete(model.getDepotID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除仓库ID为 " + model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg));
- Log.infoFileSync("====================结束调用删除仓库信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新仓库
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Depot depot = depotService.get(model.getDepotID());
- depot.setName(model.getName());
- depot.setAddress(model.getAddress());
- depot.setWarehousing(model.getWarehousing());
- depot.setTruckage(model.getTruckage());
- depot.setType(model.getType());
- depot.setSort(model.getSort());
- depot.setRemark(model.getRemark());
- depotService.update(depot);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改仓库回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新仓库", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新仓库ID为 " + model.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg));
- }
-
- /**
- * 批量删除指定ID仓库
- *
- * @return
- */
- public String batchDelete() {
- try {
- depotService.batchDelete(model.getDepotIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除仓库ID为 " + model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = depotService.checkIsNameExist("name", model.getName(), "id", model.getDepotID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找仓库信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- depotService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Depot depot : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", depot.getId());
- //供应商名称
- item.put("name", depot.getName());
- item.put("address", depot.getAddress());
- item.put("warehousing", depot.getWarehousing());
- item.put("truckage", depot.getTruckage());
- item.put("type", depot.getType());
- item.put("sort", depot.getSort());
- item.put("remark", depot.getRemark());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e);
- }
- }
-
- /**
- * 查找礼品卡-虚拟仓库
- *
- * @return
- */
- public void findGiftByType() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getConditionByType());
- depotService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Depot depot : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", depot.getId());
- //仓库名称
- item.put("name", depot.getName());
- dataArray.add(item);
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找仓库信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询仓库信息结果异常", e);
- }
- }
-
- /**
- * 用户对应仓库显示
- *
- * @return
- */
- public void findUserDepot() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(100);
- //pageUtil.setCurPage(model.getPageNo());
-
- pageUtil.setAdvSearch(getCondition_UserDepot());
- depotService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
- JSONObject outer = new JSONObject();
- outer.put("id", 1);
- outer.put("text", "仓库列表");
- outer.put("state", "open");
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Depot depot : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", depot.getId());
- item.put("text", depot.getName());
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + depot.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item.put("checked", true);
- }
- //结束
- dataArray.add(item);
- }
- }
- outer.put("children", dataArray);
- //回写查询结果
- toClient("[" + outer.toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e);
- }
- }
-
- /**
- * 根据用户查找对应仓库列表-仅显示有权限的
- *
- * @return
- */
- public void findDepotByUserId() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_UserDepot());
- depotService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Depot depot : dataList) {
- JSONObject item = new JSONObject();
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + depot.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item.put("id", depot.getId());
- item.put("depotName", depot.getName());
- dataArray.add(item);
- }
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("name_s_like", model.getName());
- condition.put("remark_s_like", model.getRemark());
- condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡
- condition.put("sort_s_order", "asc");
- return condition;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getConditionByType() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡
- condition.put("sort_s_order", "asc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-用户对应仓库
- *
- * @return
- */
- private Map getCondition_UserDepot() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("type_n_eq", 0);
- condition.put("sort_s_order", "asc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public DepotModel getModel() {
- return model;
- }
-
- public void setDepotService(DepotIService depotService) {
- this.depotService = depotService;
- }
-
- public void setUserBusinessService(UserBusinessIService userBusinessService) {
- this.userBusinessService = userBusinessService;
- }
-
-}
diff --git a/src/main/java/com/jsh/action/basic/FunctionsAction.java b/src/main/java/com/jsh/action/basic/FunctionsAction.java
deleted file mode 100644
index e5909c8c..00000000
--- a/src/main/java/com/jsh/action/basic/FunctionsAction.java
+++ /dev/null
@@ -1,566 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Functions;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.vo.basic.FunctionsModel;
-import com.jsh.service.basic.FunctionsIService;
-import com.jsh.service.basic.UserBusinessIService;
-import com.jsh.util.PageUtil;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/*
- * 功能管理
- * @author jishenghua qq:7-5-2-7-1-8-9-2-0
- */
-@SuppressWarnings("serial")
-public class FunctionsAction extends BaseAction {
- private FunctionsIService functionsService;
- private UserBusinessIService userBusinessService;
- private FunctionsModel model = new FunctionsModel();
-
- /**
- * 增加功能
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加功能信息方法create()===================");
- Boolean flag = false;
- try {
- Functions functions = new Functions();
- functions.setNumber(model.getNumber());
- functions.setName(model.getName());
- functions.setPNumber(model.getPNumber());
- functions.setURL(model.getURL());
- functions.setState(model.getState());
- functions.setSort(model.getSort());
- functions.setEnabled(model.getEnabled());
- functions.setType(model.getType());
- functions.setPushBtn(model.getPushBtn());
- functionsService.create(functions);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加功能信息异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加功能信息回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加功能", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加功能名称为 " + model.getName() + " " + tipMsg + "!", "增加功能" + tipMsg));
- Log.infoFileSync("==================结束调用增加功能方法create()===================");
- }
-
- /**
- * 删除功能
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除功能信息方法delete()================");
- try {
- functionsService.delete(model.getFunctionsID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getFunctionsID() + " 的功能异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除功能", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除功能ID为 " + model.getFunctionsID() + " " + tipMsg + "!", "删除功能" + tipMsg));
- Log.infoFileSync("====================结束调用删除功能信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新功能
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Functions functions = functionsService.get(model.getFunctionsID());
- functions.setNumber(model.getNumber());
- functions.setName(model.getName());
- functions.setPNumber(model.getPNumber());
- functions.setURL(model.getURL());
- functions.setState(model.getState());
- functions.setSort(model.getSort());
- functions.setEnabled(model.getEnabled());
- functions.setType(model.getType());
- functions.setPushBtn(model.getPushBtn());
- functionsService.update(functions);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改功能ID为 : " + model.getFunctionsID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改功能回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新功能", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新功能ID为 " + model.getFunctionsID() + " " + tipMsg + "!", "更新功能" + tipMsg));
- }
-
- /**
- * 批量删除指定ID功能
- *
- * @return
- */
- public String batchDelete() {
- try {
- functionsService.batchDelete(model.getFunctionsIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除功能ID为:" + model.getFunctionsIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除功能", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除功能ID为 " + model.getFunctionsIDs() + " " + tipMsg + "!", "批量删除功能" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = functionsService.checkIsNameExist("Name", model.getName(), "Id", model.getFunctionsID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找功能信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- functionsService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
-// {"total":28,"rows":[
-// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
-// ]}
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Functions functions : dataList) {
- JSONObject item = new JSONObject();
- item.put("Id", functions.getId());
- item.put("Number", functions.getNumber());
- item.put("Name", functions.getName());
- item.put("PNumber", functions.getPNumber());
- item.put("URL", functions.getURL());
- item.put("State", functions.getState());
- item.put("Sort", functions.getSort());
- item.put("Enabled", functions.getEnabled());
- item.put("Type", functions.getType());
- item.put("PushBtn", functions.getPushBtn());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找功能信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询功能信息结果异常", e);
- }
- }
-
- /**
- * 根据id列表查找功能信息
- *
- * @return
- */
- public void findByIds() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getConditionByIds());
- functionsService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Functions functions : dataList) {
- JSONObject item = new JSONObject();
- item.put("Id", functions.getId());
- item.put("Name", functions.getName());
- item.put("PushBtn", functions.getPushBtn());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找功能信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询功能信息结果异常", e);
- }
- }
-
-
- /**
- * 角色对应功能显示
- *
- * @return
- */
- public void findRoleFunctions() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(200);
- pageUtil.setAdvSearch(getCondition_RoleFunctions("0"));
- functionsService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
- JSONObject outer = new JSONObject();
- outer.put("id", 1);
- outer.put("text", "功能列表");
- outer.put("state", "open");
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Functions functions : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", functions.getId());
- item.put("text", functions.getName());
-
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + functions.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item.put("checked", true);
- }
- //结束
-
- pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber()));
- functionsService.find(pageUtil);
- List dataList1 = pageUtil.getPageList();
- JSONArray dataArray1 = new JSONArray();
- if (null != dataList1) {
-
- for (Functions functions1 : dataList1) {
- item.put("state", "open"); //如果不为空,节点不展开
- JSONObject item1 = new JSONObject();
- item1.put("id", functions1.getId());
- item1.put("text", functions1.getName());
-
- //勾选判断2
- //Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + functions1.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item1.put("checked", true);
- }
- //结束
-
- pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber()));
- functionsService.find(pageUtil);
- List dataList2 = pageUtil.getPageList();
- JSONArray dataArray2 = new JSONArray();
- if (null != dataList2) {
-
- for (Functions functions2 : dataList2) {
- item1.put("state", "closed"); //如果不为空,节点不展开
- JSONObject item2 = new JSONObject();
- item2.put("id", functions2.getId());
- item2.put("text", functions2.getName());
-
- //勾选判断3
- //Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + functions2.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item2.put("checked", true);
- }
- //结束
-
- pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber()));
- functionsService.find(pageUtil);
- List dataList3 = pageUtil.getPageList();
- JSONArray dataArray3 = new JSONArray();
- if (null != dataList3) {
-
- for (Functions functions3 : dataList3) {
- item2.put("state", "closed"); //如果不为空,节点不展开
- JSONObject item3 = new JSONObject();
- item3.put("id", functions3.getId());
- item3.put("text", functions3.getName());
-
- //勾选判断4
- //Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + functions3.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item3.put("checked", true);
- }
- //结束
-
- dataArray3.add(item3);
- item2.put("children", dataArray3);
- }
- }
-
- dataArray2.add(item2);
- item1.put("children", dataArray2);
- }
- }
-
- dataArray1.add(item1);
- item.put("children", dataArray1);
- }
-
- }
-
- dataArray.add(item);
- }
- outer.put("children", dataArray);
- }
- //回写查询结果
- toClient("[" + outer.toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
- }
- }
-
-
- /**
- * 页面显示菜单
- *
- * @return
- */
- public void findMenu() {
- try {
- String fc = model.getHasFunctions(); //当前用户所拥有的功能列表,格式如:[1][2][5]
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(200);
- pageUtil.setAdvSearch(getCondition_RoleFunctions(model.getPNumber()));
- functionsService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Functions functions : dataList) {
- JSONObject item = new JSONObject();
-
- item.put("id", functions.getId());
- pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber()));
- functionsService.find(pageUtil);
- List dataList1 = pageUtil.getPageList();
- JSONArray dataArray1 = new JSONArray();
- if (dataList1.size() != 0) {
- item.put("text", functions.getName()); //是目录就没链接
- for (Functions functions1 : dataList1) {
- item.put("state", "open"); //如果不为空,节点展开
- JSONObject item1 = new JSONObject();
-
- pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber()));
- functionsService.find(pageUtil);
- List dataList2 = pageUtil.getPageList();
- if (fc.indexOf("[" + functions1.getId().toString() + "]") != -1 || dataList2.size() != 0) {
- item1.put("id", functions1.getId());
- JSONArray dataArray2 = new JSONArray();
- if (dataList2.size() != 0) {
- item1.put("text", functions1.getName());//是目录就没链接
- for (Functions functions2 : dataList2) {
- item1.put("state", "closed"); //如果不为空,节点不展开
- JSONObject item2 = new JSONObject();
-
- pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber()));
- functionsService.find(pageUtil);
- List dataList3 = pageUtil.getPageList();
- if (fc.indexOf("[" + functions2.getId().toString() + "]") != -1 || dataList3.size() != 0) {
- item2.put("id", functions2.getId());
- JSONArray dataArray3 = new JSONArray();
- if (dataList3.size() != 0) {
- item2.put("text", functions2.getName());//是目录就没链接
- for (Functions functions3 : dataList3) {
- item2.put("state", "closed"); //如果不为空,节点不展开
- JSONObject item3 = new JSONObject();
- item3.put("id", functions3.getId());
- item3.put("text", functions3.getName());
- //
- dataArray3.add(item3);
- item2.put("children", dataArray3);
- }
- } else {
- //不是目录,有链接
- item2.put("text", "" + functions2.getName() + "");
- }
- } else {
- //不是目录,有链接
- item2.put("text", "" + functions2.getName() + "");
- }
- dataArray2.add(item2);
- item1.put("children", dataArray2);
- }
- } else {
- //不是目录,有链接
- item1.put("text", "" + functions1.getName() + "");
- }
- } else {
- //不是目录,有链接
- item1.put("text", "" + functions1.getName() + "");
- }
- dataArray1.add(item1);
- item.put("children", dataArray1);
- }
- } else {
- //不是目录,有链接
- item.put("text", "" + functions.getName() + "");
- }
- dataArray.add(item);
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("Name_s_like", model.getName());
- condition.put("Type_s_eq", model.getType());
- condition.put("Sort_s_order", "asc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-角色对应功能
- *
- * @return
- */
- private Map getCondition_RoleFunctions(String num) {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("Enabled_n_eq", 1);
- condition.put("PNumber_s_eq", num);
- condition.put("Sort_s_order", "asc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-角色对应功能
- *
- * @return
- */
- private Map getConditionByIds() {
- Map condition = new HashMap();
- condition.put("Enabled_n_eq", 1);
- condition.put("Id_s_in", model.getFunctionsIDs());
- condition.put("Sort_s_order", "asc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public FunctionsModel getModel() {
- return model;
- }
-
- public void setFunctionsService(FunctionsIService functionsService) {
- this.functionsService = functionsService;
- }
-
- public void setUserBusinessService(UserBusinessIService userBusinessService) {
- this.userBusinessService = userBusinessService;
- }
-
-}
diff --git a/src/main/java/com/jsh/action/basic/InOutItemAction.java b/src/main/java/com/jsh/action/basic/InOutItemAction.java
deleted file mode 100644
index f1f98d7f..00000000
--- a/src/main/java/com/jsh/action/basic/InOutItemAction.java
+++ /dev/null
@@ -1,286 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.InOutItem;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.vo.basic.InOutItemModel;
-import com.jsh.service.basic.InOutItemIService;
-import com.jsh.util.PageUtil;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 收支项目
- *
- * @author ji*sheng*hua qq 7.5.2.7.1.8.9.2.0
- */
-@SuppressWarnings("serial")
-public class InOutItemAction extends BaseAction {
- private InOutItemIService inOutItemService;
- private InOutItemModel model = new InOutItemModel();
-
- /**
- * 增加收支项目
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加收支项目方法===================");
- Boolean flag = false;
- try {
- InOutItem inOutItem = new InOutItem();
- inOutItem.setName(model.getName());
- inOutItem.setType(model.getType());
- inOutItem.setRemark(model.getRemark());
- inOutItemService.create(inOutItem);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加收支项目异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加收支项目回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加收支项目", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加收支项目名称为 " + model.getName() + " " + tipMsg + "!", "增加收支项目" + tipMsg));
- Log.infoFileSync("==================结束调用增加收支项目方法===================");
- }
-
- /**
- * 删除收支项目
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除收支项目信息方法delete()================");
- try {
- inOutItemService.delete(model.getInOutItemID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getInOutItemID() + " 的收支项目异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除收支项目", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除收支项目ID为 " + model.getInOutItemID() + ",名称为 " + model.getName() + tipMsg + "!", "删除收支项目" + tipMsg));
- Log.infoFileSync("====================结束调用删除收支项目信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新收支项目
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- InOutItem inOutItem = inOutItemService.get(model.getInOutItemID());
- inOutItem.setName(model.getName());
- inOutItem.setType(model.getType());
- inOutItem.setRemark(model.getRemark());
- inOutItemService.update(inOutItem);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改收支项目ID为 : " + model.getInOutItemID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改收支项目回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新收支项目", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新收支项目ID为 " + model.getInOutItemID() + " " + tipMsg + "!", "更新收支项目" + tipMsg));
- }
-
- /**
- * 批量删除指定ID收支项目
- *
- * @return
- */
- public String batchDelete() {
- try {
- inOutItemService.batchDelete(model.getInOutItemIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除收支项目ID为:" + model.getInOutItemIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除收支项目", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除收支项目ID为 " + model.getInOutItemIDs() + " " + tipMsg + "!", "批量删除收支项目" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = inOutItemService.checkIsNameExist("name", model.getName(), "id", model.getInOutItemID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找收支项目信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- inOutItemService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (InOutItem inOutItem : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", inOutItem.getId());
- //收支项目名称
- item.put("name", inOutItem.getName());
- item.put("type", inOutItem.getType());
- item.put("remark", inOutItem.getRemark());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e);
- }
- }
-
- /**
- * 查找收支项目信息-下拉框
- *
- * @return
- */
- public void findBySelect() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_select());
- inOutItemService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (InOutItem inOutItem : dataList) {
- JSONObject item = new JSONObject();
- item.put("Id", inOutItem.getId());
- //收支项目名称
- item.put("InOutItemName", inOutItem.getName());
- dataArray.add(item);
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("name_s_like", model.getName());
- condition.put("remark_s_like", model.getRemark());
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-下拉框-收支项目
- *
- * @return
- */
- private Map getCondition_select() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- if (model.getType().equals("in")) {
- condition.put("type_s_eq", "收入");
- } else if (model.getType().equals("out")) {
- condition.put("type_s_eq", "支出");
- }
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public InOutItemModel getModel() {
- return model;
- }
-
- public void setInOutItemService(InOutItemIService inOutItemService) {
- this.inOutItemService = inOutItemService;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/LogAction.java b/src/main/java/com/jsh/action/basic/LogAction.java
deleted file mode 100644
index 805f396f..00000000
--- a/src/main/java/com/jsh/action/basic/LogAction.java
+++ /dev/null
@@ -1,174 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.vo.basic.LogModel;
-import com.jsh.service.basic.UserIService;
-import com.jsh.util.PageUtil;
-import com.jsh.util.Tools;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/*
- *日志管理
- * @author jishenghua qq:7-5-2-7-1-8-9-2-0
- */
-@SuppressWarnings("serial")
-public class LogAction extends BaseAction {
- private LogModel model = new LogModel();
- private UserIService userService;
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- public String getBasicData() {
- Map mapData = model.getShowModel().getMap();
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- try {
- Map condition = pageUtil.getAdvSearch();
- condition.clear();
- condition.put("ismanager_n_eq", 0);
- userService.find(pageUtil);
- mapData.put("userList", pageUtil.getPageList());
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e);
- model.getShowModel().setMsgTip("exceptoin");
- }
- return SUCCESS;
- }
-
- /**
- * 删除日志
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除日志信息方法delete()================");
- try {
- logService.delete(model.getLogID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getLogID() + " 的日志异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除日志", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除日志ID为 " + model.getLogID() + " " + tipMsg + "!", "删除日志" + tipMsg));
- Log.infoFileSync("====================结束调用删除日志信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 批量删除指定ID日志
- *
- * @return
- */
- public String batchDelete() {
- try {
- logService.batchDelete(model.getLogIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除日志ID为:" + model.getLogIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除日志", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除日志ID为 " + model.getLogIDs() + " " + tipMsg + "!", "批量删除日志" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 查找日志信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- logService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
-// {"total":28,"rows":[
-// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
-// ]}
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Logdetails log : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", log.getId());
- item.put("clientIP", log.getClientIp());
- item.put("details", log.getContentdetails());
- item.put("createTime", Tools.getCenternTime(log.getCreatetime()));
- item.put("operation", log.getOperation());
- item.put("remark", log.getRemark());
- item.put("status", log.getStatus() == 0 ? "成功" : "失败");
- item.put("statusShort", log.getStatus());
- item.put("username", log.getUser() == null ? "" : log.getUser().getUsername());
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找日志信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询日志信息结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("user.id_n_eq", model.getUsernameID());
- condition.put("createtime_s_gteq", model.getBeginTime());
- condition.put("createtime_s_lteq", model.getEndTime());
- condition.put("operation_s_like", model.getOperation());
- condition.put("clientIp_s_like", model.getClientIp());
- condition.put("status_n_eq", model.getStatus());
- condition.put("contentdetails_s_like", model.getContentdetails());
- condition.put("remark_s_like", model.getRemark());
- condition.put("createtime_s_order", "desc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- public void setUserService(UserIService userService) {
- this.userService = userService;
- }
-
- @Override
- public LogModel getModel() {
- return model;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/RoleAction.java b/src/main/java/com/jsh/action/basic/RoleAction.java
deleted file mode 100644
index b74b75b6..00000000
--- a/src/main/java/com/jsh/action/basic/RoleAction.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.po.Role;
-import com.jsh.model.vo.basic.RoleModel;
-import com.jsh.service.basic.RoleIService;
-import com.jsh.service.basic.UserBusinessIService;
-import com.jsh.util.PageUtil;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/*
- * 角色管理
- * @author jishenghua qq:7-5-2-7-1-8-9-2-0
- */
-@SuppressWarnings("serial")
-public class RoleAction extends BaseAction {
- private RoleIService roleService;
- private UserBusinessIService userBusinessService;
- private RoleModel model = new RoleModel();
-
- /**
- * 增加角色
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加角色信息方法create()===================");
- Boolean flag = false;
- try {
- Role role = new Role();
- role.setName(model.getName());
- roleService.create(role);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加角色信息异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加角色信息回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加角色", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加角色名称为 " + model.getName() + " " + tipMsg + "!", "增加角色" + tipMsg));
- Log.infoFileSync("==================结束调用增加角色方法create()===================");
- }
-
- /**
- * 删除角色
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除角色信息方法delete()================");
- try {
- roleService.delete(model.getRoleID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除角色ID为 " + model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg));
- Log.infoFileSync("====================结束调用删除角色信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新角色
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Role role = roleService.get(model.getRoleID());
- role.setName(model.getName());
- roleService.update(role);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改角色ID为 : " + model.getRoleID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改角色回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新角色", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新角色ID为 " + model.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg));
- }
-
- /**
- * 批量删除指定ID角色
- *
- * @return
- */
- public String batchDelete() {
- try {
- roleService.batchDelete(model.getRoleIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除角色ID为 " + model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = roleService.checkIsNameExist("name", model.getName(), "Id", model.getRoleID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找角色信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- roleService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
-// {"total":28,"rows":[
-// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
-// ]}
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Role role : dataList) {
- JSONObject item = new JSONObject();
- item.put("Id", role.getId());
- //供应商名称
- item.put("Name", role.getName());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色信息结果异常", e);
- }
- }
-
- /**
- * 用户对应角色显示
- *
- * @return
- */
- public void findUserRole() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(100);
- //pageUtil.setCurPage(model.getPageNo());
-
- pageUtil.setAdvSearch(getCondition_UserRole());
- roleService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
- JSONObject outer = new JSONObject();
- outer.put("id", 1);
- outer.put("text", "角色列表");
- outer.put("state", "open");
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Role role : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", role.getId());
- item.put("text", role.getName());
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + role.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item.put("checked", true);
- }
- //结束
- dataArray.add(item);
- }
- }
- outer.put("children", dataArray);
- //回写查询结果
- toClient("[" + outer.toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("Name_s_like", model.getName());
- condition.put("Id_s_order", "asc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-用户对应角色
- *
- * @return
- */
- private Map getCondition_UserRole() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("Id_s_order", "asc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public RoleModel getModel() {
- return model;
- }
-
- public void setRoleService(RoleIService roleService) {
- this.roleService = roleService;
- }
-
- public void setUserBusinessService(UserBusinessIService userBusinessService) {
- this.userBusinessService = userBusinessService;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/SupplierAction.java b/src/main/java/com/jsh/action/basic/SupplierAction.java
deleted file mode 100644
index 61f1b63a..00000000
--- a/src/main/java/com/jsh/action/basic/SupplierAction.java
+++ /dev/null
@@ -1,795 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.po.Supplier;
-import com.jsh.model.vo.basic.SupplierModel;
-import com.jsh.service.basic.SupplierIService;
-import com.jsh.service.basic.UserBusinessIService;
-import com.jsh.util.JshException;
-import com.jsh.util.PageUtil;
-import com.jsh.util.SupplierConstants;
-import com.jsh.util.Tools;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/*
- * 单位管理
- * @author ji-sheng-hua qq:7 5 2 7 1 8 9 2 0
- */
-@SuppressWarnings("serial")
-public class SupplierAction extends BaseAction {
- public static final String EXCEL = "excel"; //action返回excel结果
- private final static Integer ISYSTEM = 1;
- private SupplierIService supplierService;
- private UserBusinessIService userBusinessService;
- private SupplierModel model = new SupplierModel();
-
- /**
- * 增加供应商
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加供应商方法===================");
- Boolean flag = false;
- try {
- Supplier supplier = new Supplier();
- supplier.setContacts(model.getContacts());
- supplier.setType(model.getType());
- supplier.setDescription(model.getDescription());
- supplier.setEmail(model.getEmail());
- supplier.setAdvanceIn(0.0);
- supplier.setBeginNeedGet(model.getBeginNeedGet());
- supplier.setBeginNeedPay(model.getBeginNeedPay());
- supplier.setIsystem((short) 1);
- supplier.setEnabled(true);
- supplier.setPhonenum(model.getPhonenum());
- supplier.setSupplier(model.getSupplier());
-
- supplier.setFax(model.getFax());
- supplier.setTelephone(model.getTelephone());
- supplier.setAddress(model.getAddress());
- supplier.setTaxNum(model.getTaxNum());
- supplier.setBankName(model.getBankName());
- supplier.setAccountNumber(model.getAccountNumber());
- supplier.setTaxRate(model.getTaxRate());
-
- supplierService.create(supplier);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加供应商异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加供应商回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加供应商", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加供应商名称为 " + model.getSupplier() + " " + tipMsg + "!", "增加供应商" + tipMsg));
- Log.infoFileSync("==================结束调用增加供应商方法===================");
- }
-
- /**
- * 删除供应商
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除供应商信息方法delete()================");
- try {
- supplierService.delete(model.getSupplierID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getSupplierID() + " 的供应商异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除供应商", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除供应商ID为 " + model.getSupplierID() + ",名称为 " + model.getSupplier() + tipMsg + "!", "删除供应商" + tipMsg));
- Log.infoFileSync("====================结束调用删除供应商信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新供应商
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Supplier supplier = supplierService.get(model.getSupplierID());
- supplier.setContacts(model.getContacts());
- supplier.setType(model.getType());
- supplier.setDescription(model.getDescription());
- supplier.setEmail(model.getEmail());
- supplier.setAdvanceIn(supplier.getAdvanceIn());
- supplier.setBeginNeedGet(model.getBeginNeedGet());
- supplier.setBeginNeedPay(model.getBeginNeedPay());
- supplier.setIsystem((short) 1);
- supplier.setPhonenum(model.getPhonenum());
- supplier.setSupplier(model.getSupplier());
-
- supplier.setFax(model.getFax());
- supplier.setTelephone(model.getTelephone());
- supplier.setAddress(model.getAddress());
- supplier.setTaxNum(model.getTaxNum());
- supplier.setBankName(model.getBankName());
- supplier.setAccountNumber(model.getAccountNumber());
- supplier.setTaxRate(model.getTaxRate());
-
- supplier.setEnabled(supplier.getEnabled());
- supplierService.update(supplier);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改供应商ID为 : " + model.getSupplierID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改供应商回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新供应商", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新供应商ID为 " + model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg));
- }
-
- /**
- * 更新供应商-只更新预付款,其余用原来的值
- *
- * @return
- */
- public void updateAdvanceIn() {
- Boolean flag = false;
- try {
- Supplier supplier = supplierService.get(model.getSupplierID());
- supplier.setContacts(supplier.getContacts());
- supplier.setType(supplier.getType());
- supplier.setDescription(supplier.getDescription());
- supplier.setEmail(supplier.getEmail());
- supplier.setAdvanceIn(supplier.getAdvanceIn() + model.getAdvanceIn()); //增加预收款的金额,可能增加的是负值
- supplier.setBeginNeedGet(supplier.getBeginNeedGet());
- supplier.setBeginNeedPay(supplier.getBeginNeedPay());
- supplier.setIsystem((short) 1);
- supplier.setPhonenum(supplier.getPhonenum());
- supplier.setSupplier(supplier.getSupplier());
-
- supplier.setFax(supplier.getFax());
- supplier.setTelephone(supplier.getTelephone());
- supplier.setAddress(supplier.getAddress());
- supplier.setTaxNum(supplier.getTaxNum());
- supplier.setBankName(supplier.getBankName());
- supplier.setAccountNumber(supplier.getAccountNumber());
- supplier.setTaxRate(supplier.getTaxRate());
-
- supplier.setEnabled(supplier.getEnabled());
- supplierService.update(supplier);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改供应商ID为 : " + model.getSupplierID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改供应商回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新供应商预付款", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新供应商ID为 " + model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg));
- }
-
- /**
- * 批量删除指定ID供应商
- *
- * @return
- */
- public String batchDelete() {
- try {
- supplierService.batchDelete(model.getSupplierIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除供应商ID为:" + model.getSupplierIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除供应商", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除供应商ID为 " + model.getSupplierIDs() + " " + tipMsg + "!", "批量删除供应商" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 批量设置状态-启用或者禁用
- *
- * @return
- */
- public String batchSetEnable() {
- try {
- supplierService.batchSetEnable(model.getEnabled(), model.getSupplierIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量修改状态,单位ID为:" + model.getSupplierIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量修改单位状态", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量修改状态,单位ID为 " + model.getSupplierIDs() + " " + tipMsg + "!", "批量修改单位状态" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = supplierService.checkIsNameExist("supplier", model.getSupplier(), "id", model.getSupplierID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找供应商信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- supplierService.find(pageUtil);
- String sName = "";
- if ((model.getType()).equals("供应商")) {
- sName = "pageUtilVendor";
- } else if ((model.getType()).equals("客户")) {
- sName = "pageUtilCustomer";
- } else if ((model.getType()).equals("会员")) {
- sName = "pageUtilMember";
- }
- getSession().put(sName, pageUtil);
- List dataList = pageUtil.getPageList();
-
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Supplier supplier : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", supplier.getId());
- //供应商名称
- item.put("supplier", supplier.getSupplier());
- item.put("type", supplier.getType());
- item.put("contacts", supplier.getContacts());
- item.put("phonenum", supplier.getPhonenum());
- item.put("email", supplier.getEmail());
- item.put("AdvanceIn", supplier.getAdvanceIn());
- item.put("BeginNeedGet", supplier.getBeginNeedGet());
- item.put("BeginNeedPay", supplier.getBeginNeedPay());
- item.put("isystem", supplier.getIsystem() == (short) 0 ? "是" : "否");
- item.put("description", supplier.getDescription());
-
- item.put("fax", supplier.getFax());
- item.put("telephone", supplier.getTelephone());
- item.put("address", supplier.getAddress());
- item.put("taxNum", supplier.getTaxNum());
- item.put("bankName", supplier.getBankName());
- item.put("accountNumber", supplier.getAccountNumber());
- item.put("taxRate", supplier.getTaxRate());
-
- item.put("enabled", supplier.getEnabled());
- item.put("op", supplier.getIsystem());
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e);
- }
- }
-
- /**
- * 根据id查找信息
- *
- * @return
- */
- public void findById() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getConditionById());
- supplierService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Supplier supplier : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", supplier.getId());
- //名称
- item.put("supplier", supplier.getSupplier());
- item.put("type", supplier.getType());
- item.put("contacts", supplier.getContacts());
- item.put("phonenum", supplier.getPhonenum());
- item.put("email", supplier.getEmail());
- item.put("AdvanceIn", supplier.getAdvanceIn());
- item.put("BeginNeedGet", supplier.getBeginNeedGet());
- item.put("BeginNeedPay", supplier.getBeginNeedPay());
- item.put("isystem", supplier.getIsystem() == (short) 0 ? "是" : "否");
- item.put("description", supplier.getDescription());
-
- item.put("fax", supplier.getFax());
- item.put("telephone", supplier.getTelephone());
- item.put("address", supplier.getAddress());
- item.put("taxNum", supplier.getTaxNum());
- item.put("bankName", supplier.getBankName());
- item.put("accountNumber", supplier.getAccountNumber());
- item.put("taxRate", supplier.getTaxRate());
-
- item.put("enabled", supplier.getEnabled());
- item.put("op", supplier.getIsystem());
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询信息结果异常", e);
- }
- }
-
- /**
- * 查找供应商信息-下拉框
- *
- * @return
- */
- public void findBySelect_sup() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_Select_sup());
- supplierService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Supplier supplier : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", supplier.getId());
- //供应商名称
- item.put("supplier", supplier.getSupplier());
- dataArray.add(item);
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e);
- }
- }
-
- /**
- * 查找客户信息-下拉框
- *
- * @return
- */
- public void findBySelect_cus() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_Select_cus());
- supplierService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Supplier supplier : dataList) {
- JSONObject item = new JSONObject();
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + supplier.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>查询用户对应的客户:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item.put("id", supplier.getId());
- item.put("supplier", supplier.getSupplier()); //客户名称
- dataArray.add(item);
- }
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找客户信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e);
- }
- }
-
- /**
- * 查找会员信息-下拉框
- *
- * @return
- */
- public void findBySelect_retail() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_Select_retail());
- supplierService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Supplier supplier : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", supplier.getId());
- //客户名称
- item.put("supplier", supplier.getSupplier());
- item.put("advanceIn", supplier.getAdvanceIn()); //预付款金额
- dataArray.add(item);
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找客户信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e);
- }
- }
-
- /**
- * 查找非会员的id
- */
- public void findBySelectRetailNoPeople() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition_Select_retail_no_people());
- supplierService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Supplier supplier : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", supplier.getId());
- //客户名称
- item.put("supplier", supplier.getSupplier());
- item.put("advanceIn", supplier.getAdvanceIn()); //预付款金额
- dataArray.add(item);
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找客户信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e);
- }
- }
-
- /**
- * 用户对应客户显示
- *
- * @return
- */
- public void findUserCustomer() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(500);
-
- Map condition = new HashMap();
- condition.put("type_s_eq", "客户");
- condition.put("id_s_order", "desc");
-
- pageUtil.setAdvSearch(condition);
- supplierService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
- JSONObject outer = new JSONObject();
- outer.put("id", 1);
- outer.put("text", "客户列表");
- outer.put("state", "open");
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Supplier supplier : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", supplier.getId());
- item.put("text", supplier.getSupplier());
- //勾选判断1
- Boolean flag = false;
- try {
- flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + supplier.getId().toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的客户:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!");
- }
- if (flag == true) {
- item.put("checked", true);
- }
- //结束
- dataArray.add(item);
- }
- }
- outer.put("children", dataArray);
- //回写查询结果
- toClient("[" + outer.toString() + "]");
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找客户异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询客户结果异常", e);
- }
- }
-
- public String importFun() {
- //excel表格file
- Boolean result = false;
- String returnStr = "";
- try {
- InputStream in = supplierService.importExcel(model.getSupplierFile());
-
- if (null != in) {
- model.setFileName(Tools.getRandomChar() + Tools.getNow2(Calendar.getInstance().getTime()) + "_wrong.xls");
- model.setExcelStream(in);
- returnStr = SupplierConstants.BusinessForExcel.EXCEL;
- } else {
- result = true;
- try {
- toClient(result.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写导入信息结果异常", e);
- }
- //导入数据成功
- returnStr = SUCCESS;
- }
-
- } catch (JshException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>导入excel表格信息异常", e);
- }
- return returnStr;
- }
-
- /**
- * 导入excel表格-供应商
- *
- * @return
- */
- @SuppressWarnings("unchecked")
- public String importExcelVendor() {
- return importFun();
- }
-
- /**
- * 导入excel表格-客户
- *
- * @return
- */
- @SuppressWarnings("unchecked")
- public String importExcelCustomer() {
- return importFun();
- }
-
- /**
- * 导入excel表格-会员
- *
- * @return
- */
- @SuppressWarnings("unchecked")
- public String importExcelMember() {
- return importFun();
- }
-
-
- /**
- * 导出excel表格
- *
- * @return
- */
- @SuppressWarnings("unchecked")
- public String exportExcel() {
- Log.infoFileSync("===================调用导出信息action方法exportExcel开始=======================");
- try {
- String sName = "pageUtil" + model.getType();
- PageUtil pageUtil = (PageUtil) getSession().get(sName);
-
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- String isCurrentPage = "allPage";
- model.setFileName(Tools.changeUnicode("report" + System.currentTimeMillis() + ".xls", model.getBrowserType()));
- model.setExcelStream(supplierService.exmportExcel(isCurrentPage, pageUtil));
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常", e);
- model.getShowModel().setMsgTip("export excel exception");
- }
- Log.infoFileSync("===================调用导出信息action方法exportExcel结束==================");
- return EXCEL;
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("supplier_s_like", model.getSupplier());
- condition.put("type_s_like", model.getType());
- condition.put("phonenum_s_like", model.getPhonenum());
- condition.put("telephone_s_like", model.getTelephone());
- condition.put("description_s_like", model.getDescription());
- condition.put("isystem_n_eq", ISYSTEM);
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- /**
- * 搜索条件
- */
- private Map getConditionById() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("Id_n_eq", model.getSupplierID());
- return condition;
- }
-
- /**
- * 拼接搜索条件-下拉框-供应商
- *
- * @return
- */
- private Map getCondition_Select_sup() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("type_s_like", "供应商");
- condition.put("enabled_s_eq", 1);
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-下拉框-客户
- *
- * @return
- */
- private Map getCondition_Select_cus() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("type_s_like", "客户");
- condition.put("enabled_s_eq", 1);
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-下拉框-会员
- *
- * @return
- */
- private Map getCondition_Select_retail() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("type_s_like", "会员");
- condition.put("enabled_s_eq", 1);
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- /**
- * 拼接搜索条件-非会员
- *
- * @return
- */
- private Map getCondition_Select_retail_no_people() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("type_s_like", "会员");
- condition.put("isystem_n_eq", 0);
- condition.put("id_s_order", "desc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public SupplierModel getModel() {
- return model;
- }
-
- public void setSupplierService(SupplierIService supplierService) {
- this.supplierService = supplierService;
- }
-
- public void setUserBusinessService(UserBusinessIService userBusinessService) {
- this.userBusinessService = userBusinessService;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/SystemConfigAction.java b/src/main/java/com/jsh/action/basic/SystemConfigAction.java
deleted file mode 100644
index 7aaeb456..00000000
--- a/src/main/java/com/jsh/action/basic/SystemConfigAction.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.po.SystemConfig;
-import com.jsh.model.vo.basic.SystemConfigModel;
-import com.jsh.service.basic.SystemConfigIService;
-import com.jsh.util.PageUtil;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.springframework.dao.DataAccessException;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/*
- * 系统配置
- * @author jishenghua qq:7-5-2-7 1-8-9-2-0
- */
-@SuppressWarnings("serial")
-public class SystemConfigAction extends BaseAction {
- private SystemConfigIService systemConfigService;
- private SystemConfigModel model = new SystemConfigModel();
-
- /**
- * 更新系统配置
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- SystemConfig sysConfig = systemConfigService.get(model.getId());
- sysConfig.setType(sysConfig.getType());
- sysConfig.setName(sysConfig.getName());
- sysConfig.setValue(model.getValue());
- sysConfig.setDescription(sysConfig.getDescription());
- systemConfigService.update(sysConfig);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改系统配置ID为 : " + model.getId() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改系统配置回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新系统配置", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新系统配置ID为 " + model.getId() + " " + tipMsg + "!", "更新系统配置" + tipMsg));
- }
-
- /**
- * 查找系统配置信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition());
- systemConfigService.find(pageUtil);
- List dataList = pageUtil.getPageList();
- JSONObject outer = new JSONObject();
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (SystemConfig sysConfig : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", sysConfig.getId());
- item.put("type", sysConfig.getType());
- item.put("name", sysConfig.getName());
- item.put("value", sysConfig.getValue());
- item.put("description", sysConfig.getDescription());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找系统配置信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询系统配置信息结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("id_s_order", "asc");
- return condition;
- }
-
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public SystemConfigModel getModel() {
- return model;
- }
-
- public void setSystemConfigService(SystemConfigIService systemConfigService) {
- this.systemConfigService = systemConfigService;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/UnitAction.java b/src/main/java/com/jsh/action/basic/UnitAction.java
deleted file mode 100644
index 931482d1..00000000
--- a/src/main/java/com/jsh/action/basic/UnitAction.java
+++ /dev/null
@@ -1,262 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.po.Unit;
-import com.jsh.model.vo.basic.UnitModel;
-import com.jsh.service.basic.UnitIService;
-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 shenghua qq:752 718 920
- */
-@SuppressWarnings("serial")
-public class UnitAction extends BaseAction {
- private UnitIService unitService;
- private UnitModel model = new UnitModel();
-
-
- /**
- * 增加计量单位
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加计量单位方法create()===================");
- Boolean flag = false;
- try {
- Unit unit = new Unit();
- unit.setUName(model.getUName());
- unitService.create(unit);
-
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加计量单位异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加计量单位回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加计量单位", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加计量单位名称为 " + model.getUName() + " " + tipMsg + "!", "增加计量单位" + tipMsg));
- Log.infoFileSync("==================结束调用增加计量单位方法create()===================");
- }
-
- /**
- * 删除计量单位
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除计量单位方法delete()================");
- try {
- unitService.delete(model.getUnitID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUnitID() + " 的计量单位异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除计量单位", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除计量单位ID为 " + model.getUnitID() + " " + tipMsg + "!", "删除计量单位" + tipMsg));
- Log.infoFileSync("====================结束调用删除计量单位方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新计量单位
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Unit unit = unitService.get(model.getUnitID());
- unit.setUName(model.getUName());
- unitService.update(unit);
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改计量单位ID为 : " + model.getUnitID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改计量单位回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新计量单位", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新计量单位ID为 " + model.getUnitID() + " " + tipMsg + "!", "更新计量单位" + tipMsg));
- }
-
- /**
- * 批量删除指定ID计量单位
- *
- * @return
- */
- public String batchDelete() {
- try {
- unitService.batchDelete(model.getUnitIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除计量单位ID为:" + model.getUnitIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除计量单位", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除计量单位ID为 " + model.getUnitIDs() + " " + tipMsg + "!", "批量删除计量单位" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- try {
- flag = unitService.checkIsNameExist("UName", model.getUName(), "id", model.getUnitID());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查计量单位名称为:" + model.getUName() + " ID为: " + model.getUnitID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查计量单位名称为:" + model.getUName() + " ID为: " + model.getUnitID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找计量单位信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- unitService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Unit unit : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", unit.getId());
- //名称
- item.put("UName", unit.getUName());
- item.put("op", 1);
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找计量单位异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询计量单位结果异常", e);
- }
- }
-
- /**
- * 查找计量单位信息-下拉框
- *
- * @return
- */
- public void findUnitDownList() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(0);
- pageUtil.setCurPage(0);
- pageUtil.setAdvSearch(getCondition());
- unitService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Unit unit : dataList) {
- JSONObject item = new JSONObject();
- item.put("id", unit.getId());
- //名称
- item.put("UName", unit.getUName());
- dataArray.add(item);
- }
- }
- //回写查询结果
- toClient(dataArray.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找计量单位异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询计量单位结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map condition = new HashMap();
- condition.put("UName_s_like", model.getUName());
- condition.put("id_s_order", "asc");
- return condition;
- }
-
- //=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
- @Override
- public UnitModel getModel() {
- return model;
- }
-
- public void setUnitService(UnitIService unitService) {
- this.unitService = unitService;
- }
-}
diff --git a/src/main/java/com/jsh/action/basic/UserAction.java b/src/main/java/com/jsh/action/basic/UserAction.java
deleted file mode 100644
index 11eae985..00000000
--- a/src/main/java/com/jsh/action/basic/UserAction.java
+++ /dev/null
@@ -1,446 +0,0 @@
-package com.jsh.action.basic;
-
-import com.jsh.base.BaseAction;
-import com.jsh.base.Log;
-import com.jsh.model.po.Basicuser;
-import com.jsh.model.po.Logdetails;
-import com.jsh.model.vo.basic.UserModel;
-import com.jsh.service.basic.UserIService;
-import com.jsh.util.ExceptionCodeConstants;
-import com.jsh.util.PageUtil;
-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.security.NoSuchAlgorithmException;
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/*
- * 用户管理
- * @author jishenghua qq:752718920
- */
-@SuppressWarnings("serial")
-public class UserAction extends BaseAction {
- private UserModel model = new UserModel();
- private UserIService userService;
-
- /**
- * 需要判断用户状态,用户名密码错误不能登录 ,黑名单用户不能登录,如果已经登录过,不再进行处理,直接进入管理页面
- *
- * @return
- */
- public String login() {
- Log.infoFileSync("============用户登录 login 方法调用开始==============");
- String username = model.getLoginame().trim();
- String password = model.getPassword().trim();
- //因密码用MD5加密,需要对密码进行转化
- try {
- password = Tools.md5Encryp(password);
- System.out.println(password);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e);
- }
-
- //判断用户是否已经登录过,登录过不再处理
- Basicuser sessionUser = (Basicuser) getSession().get("user");
- if (null != sessionUser && username.equalsIgnoreCase(sessionUser.getLoginame())
- && sessionUser.getPassword().equals(password)) {
- Log.infoFileSync("====用户 " + username + "已经登录过, login 方法调用结束====");
- model.getShowModel().setMsgTip("user already login");
- /*return "login";*/
- }
-
- //获取用户状态
- int userStatus = -1;
- try {
- userStatus = userService.validateUser(username, password);
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====", e);
- model.getShowModel().setMsgTip("access service exception");
- }
- switch (userStatus) {
- case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST:
- model.getShowModel().setMsgTip("user is not exist");
- break;
- case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR:
- model.getShowModel().setMsgTip("user password error");
- break;
- case ExceptionCodeConstants.UserExceptionCode.BLACK_USER:
- model.getShowModel().setMsgTip("user is black");
- break;
- case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION:
- model.getShowModel().setMsgTip("access service error");
- break;
- default:
- try {
- //验证通过 ,可以登录,放入session,记录登录日志
- Basicuser user = userService.getUser(username);
- logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
- new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统"));
- model.getShowModel().setMsgTip("user can login");
- getSession().put("user", user);
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e);
- }
- break;
- }
- /*if(ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT == userStatus)
- return "login";*/
- Log.infoFileSync("===============用户登录 login 方法调用结束===============");
- return SUCCESS;
- }
-
- /**
- * 用户退出登录
- *
- * @return
- */
- public String logout() {
- logService.create(new Logdetails(getUser(), "退出系统", model.getClientIp(),
- new Timestamp(System.currentTimeMillis()), (short) 0,
- "管理用户:" + getUser().getLoginame() + " 退出系统", getUser().getLoginame() + " 退出系统"));
- getSession().remove("user");
- return SUCCESS;
- }
-
- /**
- * 增加用户
- *
- * @return
- */
- public void create() {
- Log.infoFileSync("==================开始调用增加用户方法===================");
- Boolean flag = false;
- try {
- Basicuser user = new Basicuser();
- user.setDepartment(model.getDepartment());
- user.setDescription(model.getDescription());
- user.setEmail(model.getEmail());
- user.setIsmanager((short) 1);
- user.setIsystem((short) 0);
- user.setLoginame(model.getLoginame());
- String password = "123456";
- //因密码用MD5加密,需要对密码进行转化
- try {
- password = Tools.md5Encryp(password);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e);
- }
- user.setPassword(password);
-
- user.setPhonenum(model.getPhonenum());
- user.setPosition(model.getPosition());
- user.setUsername(model.getUsername());
-
- userService.create(user);
- //========标识位===========
- flag = true;
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加用户异常", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>增加用户回写客户端结果异常", e);
- }
- }
-
- logService.create(new Logdetails(getUser(), "增加用户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "增加用户名称为 " + model.getUsername() + " " + tipMsg + "!", "增加用户" + tipMsg));
- Log.infoFileSync("==================结束调用增加用户方法===================");
- }
-
- /**
- * 删除用户
- *
- * @return
- */
- public String delete() {
- Log.infoFileSync("====================开始调用删除用户信息方法delete()================");
- try {
- userService.delete(model.getUserID());
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUserID() + " 的用户异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
- model.getShowModel().setMsgTip(tipMsg);
- logService.create(new Logdetails(getUser(), "删除用户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "删除用户ID为 " + model.getUserID() + " " + tipMsg + "!", "删除用户" + tipMsg));
- Log.infoFileSync("====================结束调用删除用户信息方法delete()================");
- return SUCCESS;
- }
-
- /**
- * 更新用户
- *
- * @return
- */
- public void update() {
- Boolean flag = false;
- try {
- Basicuser user = userService.get(model.getUserID());
- user.setDepartment(model.getDepartment());
- user.setDescription(model.getDescription());
- user.setEmail(model.getEmail());
- //user.setIsmanager(model.getIsmanager());
- user.setLoginame(model.getLoginame());
- //user.setPassword(model.getPassword());
- user.setPhonenum(model.getPhonenum());
- user.setPosition(model.getPosition());
- user.setUsername(model.getUsername());
- userService.update(user);
-
- //看是否需要更新seesion中user
- if (getUser().getId() == model.getUserID()) {
- getSession().put("user", user);
- }
-
- flag = true;
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "信息失败", e);
- flag = false;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改用户回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新用户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新用户ID为 " + model.getUserID() + " " + tipMsg + "!", "更新用户" + tipMsg));
- }
-
- /**
- * 修改密码
- */
- public void updatePwd() {
- Integer flag = 0;
- try {
- Basicuser user = getUser();
- String orgPassword = Tools.md5Encryp(model.getOrgpwd());
- String md5Pwd = Tools.md5Encryp(model.getPassword());
- //必须和原始密码一致才可以更新密码
- if(user.getLoginame().equals("jsh")){
- flag = 3;
- tipMsg = "管理员jsh不能修改密码";
- tipType = 1;
- } else if (orgPassword.equalsIgnoreCase(user.getPassword())) {
-
- user.setPassword(md5Pwd);
- userService.update(user);
-
- //看是否需要更新seesion中user
-// if(getUser().getId() == model.getUserID())
-// {
-// getSession().put("user", user);
-// }
-
- flag = 1;
- tipMsg = "成功";
- tipType = 0;
- } else {
- flag = 2;
- tipMsg = "失败";
- tipType = 1;
- }
-
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "密码信息失败", e);
- flag = 3;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改用户密码回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "更新用户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "更新用户ID为 " + model.getUserID() + "密码信息 " + tipMsg + "!", "更新用户" + tipMsg));
- }
-
- /**
- * 重置用户的密码
- */
- public void resetPwd() {
- Integer flag = 0;
- try {
- Basicuser user = userService.get(model.getUserID());
- String password = "123456";
- String md5Pwd = Tools.md5Encryp(password);
- user.setPassword(md5Pwd);
- userService.update(user);
- flag = 1;
- tipMsg = "成功";
- tipType = 0;
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "密码信息失败", e);
- flag = 0;
- tipMsg = "失败";
- tipType = 1;
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>修改用户密码回写客户端结果异常", e);
- }
- }
- logService.create(new Logdetails(getUser(), "重置用户密码", model.getClientIp(),
- new Timestamp(System.currentTimeMillis()), tipType, "重置用户ID为 " + model.getUserID() + "密码信息 " + tipMsg + "!", "重置用户密码" + tipMsg));
- }
-
- /**
- * 批量删除指定ID用户
- *
- * @return
- */
- public String batchDelete() {
- try {
- userService.batchDelete(model.getUserIDs());
- model.getShowModel().setMsgTip("成功");
- //记录操作日志使用
- tipMsg = "成功";
- tipType = 0;
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>>>批量删除用户ID为:" + model.getUserIDs() + "信息异常", e);
- tipMsg = "失败";
- tipType = 1;
- }
-
- logService.create(new Logdetails(getUser(), "批量删除用户", model.getClientIp(),
- new Timestamp(System.currentTimeMillis())
- , tipType, "批量删除用户ID为 " + model.getUserIDs() + " " + tipMsg + "!", "批量删除用户" + tipMsg));
- return SUCCESS;
- }
-
- /**
- * 检查输入名称是否存在
- */
- public void checkIsNameExist() {
- Boolean flag = false;
- String fieldName = "";
- String fieldValue = "";
- try {
- if (0 == model.getCheckFlag()) {
- fieldName = "username";
- fieldValue = model.getUsername();
- } else {
- fieldName = "loginame";
- fieldValue = model.getLoginame();
- }
- flag = userService.checkIsNameExist(fieldName, fieldValue, model.getUserID());
- } catch (Exception e) {
- Log.errorFileSync(">>>>>>>>>>>>>>>>>检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!");
- } finally {
- try {
- toClient(flag.toString());
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>>>>回写检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!", e);
- }
- }
- }
-
- /**
- * 查找用户信息
- *
- * @return
- */
- public void findBy() {
- try {
- PageUtil pageUtil = new PageUtil();
- pageUtil.setPageSize(model.getPageSize());
- pageUtil.setCurPage(model.getPageNo());
- pageUtil.setAdvSearch(getCondition());
- userService.find(pageUtil);
- List dataList = pageUtil.getPageList();
-
- //开始拼接json数据
-// {"total":28,"rows":[
-// {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"}
-// ]}
- JSONObject outer = new JSONObject();
- outer.put("total", pageUtil.getTotalCount());
- //存放数据json数组
- JSONArray dataArray = new JSONArray();
- if (null != dataList) {
- for (Basicuser user : dataList) {
-
- JSONObject item = new JSONObject();
- item.put("id", user.getId());
- item.put("username", user.getUsername());
- item.put("loginame", Tools.dealNullStr(user.getLoginame()));
- item.put("password", Tools.dealNullStr(user.getPassword()));
- item.put("position", Tools.dealNullStr(user.getPosition()));
- item.put("department", Tools.dealNullStr(user.getDepartment()));
- item.put("email", Tools.dealNullStr(user.getEmail()));
- item.put("phonenum", Tools.dealNullStr(user.getPhonenum()));
- item.put("ismanager", user.getIsmanager() == (short) 0 ? "是" : "否");
- item.put("isystem", user.getIsystem() == (short) 0 ? "是" : "否");
- item.put("status", user.getStatus());
- item.put("description", Tools.dealNullStr(user.getDescription()));
- item.put("remark", user.getRemark());
- item.put("op", user.getIsmanager());
- dataArray.add(item);
- }
- }
- outer.put("rows", dataArray);
- //回写查询结果
- toClient(outer.toString());
- } catch (DataAccessException e) {
- Log.errorFileSync(">>>>>>>>>查找用户信息异常", e);
- } catch (IOException e) {
- Log.errorFileSync(">>>>>>>>>回写查询用户信息结果异常", e);
- }
- }
-
- /**
- * 拼接搜索条件
- *
- * @return 拼接后的条件
- */
- private Map getCondition() {
- /**
- * 拼接搜索条件
- */
- Map