Commit 227cf3b2 authored by 季圣华's avatar 季圣华
Browse files

优化界面,给商品和单位模块增加了部分字段

parent c8f80894
......@@ -33,7 +33,6 @@
<mapping resource="com/jsh/model/po/Role.hbm.xml" />
<mapping resource="com/jsh/model/po/Functions.hbm.xml" />
<mapping resource="com/jsh/model/po/UserBusiness.hbm.xml" />
<mapping resource="com/jsh/model/po/VisitAccount.hbm.xml" />
<mapping resource="com/jsh/model/po/Person.hbm.xml" />
<mapping resource="com/jsh/model/po/MaterialCategory.hbm.xml" />
<mapping resource="com/jsh/model/po/Material.hbm.xml" />
......
......@@ -238,18 +238,6 @@
</bean>
<!--资产报表配置结束 -->
<!--回访台帐配置开始 -->
<bean id="visitAccountService" class="com.jsh.service.basic.VisitAccountService">
<property name="baseDao" ref="baseDao"/>
<property name="visitAccountDao" ref="visitAccountDao"/>
</bean>
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<bean id="visitAccountAction" class="com.jsh.action.basic.VisitAccountAction" scope="prototype">
<property name="visitAccountService" ref="visitAccountService"/>
<property name="logService" ref="logService"/>
</bean>
<!--回访台帐配置结束 -->
<!--经手人配置开始 -->
<bean id="personService" class="com.jsh.service.materials.PersonService">
<property name="baseDao" ref="baseDao"/>
......@@ -262,7 +250,7 @@
</bean>
<!--经手人配置结束 -->
<!--物料类别配置开始 -->
<!--商品类别配置开始 -->
<bean id="materialCategoryService" class="com.jsh.service.materials.MaterialCategoryService">
<property name="baseDao" ref="baseDao"/>
<property name="materialCategoryDao" ref="materialCategoryDao"/>
......@@ -272,9 +260,9 @@
<property name="materialCategoryService" ref="materialCategoryService"/>
<property name="logService" ref="logService"/>
</bean>
<!--物料类别配置结束 -->
<!--商品类别配置结束 -->
<!--物料配置开始 -->
<!--商品配置开始 -->
<bean id="materialService" class="com.jsh.service.materials.MaterialService">
<property name="baseDao" ref="baseDao"/>
<property name="materialDao" ref="materialDao"/>
......@@ -284,7 +272,7 @@
<property name="materialService" ref="materialService"/>
<property name="logService" ref="logService"/>
</bean>
<!--物料配置结束 -->
<!--商品配置结束 -->
<!--单元配置开始 -->
<bean id="buildingService" class="com.jsh.service.materials.BuildingService">
......
......@@ -34,8 +34,6 @@
<bean id="functionsDao" parent="daoTemplate" class="com.jsh.dao.basic.FunctionsDAO"/>
<!-- 配置userBusinessDao组件 -->
<bean id="userBusinessDao" parent="daoTemplate" class="com.jsh.dao.basic.UserBusinessDAO"/>
<!-- 配置visitAccountDao组件 -->
<bean id="visitAccountDao" parent="daoTemplate" class="com.jsh.dao.basic.VisitAccountDAO"/>
<!-- 配置personDao组件 -->
<bean id="personDao" parent="daoTemplate" class="com.jsh.dao.materials.PersonDAO"/>
<!-- 配置materialCategoryDao组件 -->
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="visitAccount" namespace="/visitAccount" extends="json-default">
<action name="*" class="visitAccountAction" method="{1}">
<result type="json"/>
</action>
</package>
</struts>
\ No newline at end of file
......@@ -382,7 +382,7 @@ INSERT INTO `jsh_assetname` VALUES ('1','联想Y450','17','1','','1'), ('2','惠
INSERT INTO `jsh_depot` VALUES ('1','上海花边店','1','');
INSERT INTO `jsh_depothead` VALUES ('29','入库','采购','1','1234','李四','2016-11-08 22:14:37','2016-11-08 00:00:00','1','2','1','记账',NULL,NULL,'','草稿',NULL,NULL), ('30','入库','采购','1','1235','李四','2016-11-08 22:15:16','2016-11-08 00:00:00','1','2','1','记账',NULL,NULL,'','草稿',NULL,NULL), ('31','出库','销售','1','123A','李四','2016-11-08 22:16:11','2016-11-08 00:00:00','2',NULL,'1','',NULL,NULL,'','草稿',NULL,NULL), ('32','入库','采购','1','ww123','季圣华','2016-11-25 22:14:46','2016-11-25 00:00:00','1','2','1','现金',NULL,NULL,'','草稿',NULL,NULL);
INSERT INTO `jsh_depotitem` VALUES ('1014','29','485','300','0.4',NULL,'',''), ('1015','29','487','200','0.2',NULL,'',''), ('1016','30','498','432','0.5',NULL,'',''), ('1017','31','485','100','0.6',NULL,'',''), ('1018','32','487','1','0.9',NULL,'','');
INSERT INTO `jsh_functions` VALUES ('1','00','系统管理','0','','','0010','','电脑版'), ('2','01','基础数据','0','','','0020','','电脑版'), ('3','02','物资管理','0','','','0030','','电脑版'), ('10','09','留言管理','0','','\0','0100','','手机版'), ('11','0001','系统管理','00','','\0','0110','','电脑版'), ('12','000101','应用管理','0001','../manage/app.jsp','\0','0132','','电脑版'), ('13','000102','角色管理','0001','../manage/role.jsp','\0','0130','','电脑版'), ('14','000103','用户管理','0001','../user/user.jsp','\0','0140','','电脑版'), ('15','000104','日志管理','0001','../log/operatelog.jsp','\0','0160','','电脑版'), ('16','000105','功能管理','0001','../manage/functions.jsp','\0','0135','','电脑版'), ('21','0101','物料管理','01','','\0','0220','','电脑版'), ('22','010101','物料类别管理','0101','../materials/materialcategory.jsp','\0','0230','','电脑版'), ('23','010102','物料档案管理','0101','../materials/material.jsp','\0','0240','','电脑版'), ('24','0102','公司数据管理','01','','\0','0250','','电脑版'), ('25','010201','单位信息','0102','../manage/vendor.jsp','\0','0260','','电脑版'), ('26','010202','部门管理','0102','../manage/depot.jsp','\0','0270','','电脑版'), ('30','0201','其他管理','02','','\0','0310','','电脑版'), ('31','020101','经手人管理','0201','../materials/person.jsp','\0','0312','','电脑版'), ('32','0202','入库管理','02','','\0','0330','','电脑版'), ('33','020201','采购入库','0202','../materials/purchase_in_list.jsp','\0','0340','','电脑版'), ('34','020202','甲供入库','0202','../materials/supply_in_list.jsp','\0','0350','','电脑版'), ('35','020203','租赁入库','0202','../materials/lease_in_list.jsp','\0','0360','','电脑版'), ('36','020204','回收入库','0202','../materials/recover_in_list.jsp','\0','0370','','电脑版'), ('37','020205','调拨入库','0202','../materials/allocation_in_list.jsp','\0','0380','','电脑版'), ('38','0203','出库管理','02','','\0','0390','','电脑版'), ('39','020301','领用出库','0203','../materials/consuming_out_list.jsp','\0','0400','','电脑版'), ('40','020302','调拨出库','0203','../materials/allocation_out_list.jsp','\0','0410','','电脑版'), ('41','020303','销售出库','0203','../materials/sale_out_list.jsp','\0','0420','','电脑版'), ('42','020304','退还出库','0203','../materials/return_out_list.jsp','\0','0430','','电脑版'), ('43','020305','报废出库','0203','../materials/other_out_list.jsp','\0','0430','','电脑版'), ('44','0204','财务管理','02','','\0','0450','','电脑版'), ('45','020401','单据审核','0204','','','0460','','电脑版'), ('46','02040101','采购入库审核','020401','../materials/audit_purchase_in_list.jsp','\0','0470','','电脑版'), ('47','02040102','甲供入库审核','020401','../materials/audit_supply_in_list.jsp','\0','0480','','电脑版'), ('48','02040103','租赁入库审核','020401','../materials/audit_lease_in_list.jsp','\0','0490','','电脑版'), ('49','02040104','调拨出库审核','020401','../materials/audit_allocation_out_list.jsp','\0','0500','','电脑版'), ('50','02040105','领用出库审核','020401','../materials/audit_consuming_out_list.jsp','\0','0510','','电脑版'), ('51','02040106','退还出库审核','020401','../materials/audit_return_out_list.jsp','\0','0520','','电脑版'), ('52','020402','采购定价','0204','../materials/fix_purchase_in_list.jsp','\0','0530','','电脑版'), ('53','020403','租赁定价','0204','../materials/fix_lease_in_list.jsp','\0','0540','','电脑版'), ('54','020404','调拨定价','0204','../materials/fix_allocation_out_list.jsp','\0','0550','','电脑版'), ('55','020405','销售定价','0204','../materials/fix_sale_out_list.jsp','\0','0560','','电脑版'), ('58','0205','报表中心','02','','\0','0590','','电脑版'), ('59','020501','项目进销存报表','0205','../reports/in_out_stock_report.jsp','\0','0600','','电脑版'), ('193','02040107','销售出库审核','020401','../materials/audit_sale_out_list.jsp','\0','0525','','电脑版'), ('194','010204','收支项目','0102','../manage/inOutItem.jsp','\0','0282','','电脑版'), ('195','010205','结算账户','0102','../manage/account.jsp','\0','0283','','电脑版');
INSERT INTO `jsh_functions` VALUES ('1','00','系统管理','0','','','0010','','电脑版'), ('2','01','基础数据','0','','','0020','','电脑版'), ('3','02','物资管理','0','','','0030','','电脑版'), ('10','09','留言管理','0','','\0','0100','','手机版'), ('11','0001','系统管理','00','','\0','0110','','电脑版'), ('12','000101','应用管理','0001','../manage/app.jsp','\0','0132','','电脑版'), ('13','000102','角色管理','0001','../manage/role.jsp','\0','0130','','电脑版'), ('14','000103','用户管理','0001','../user/user.jsp','\0','0140','','电脑版'), ('15','000104','日志管理','0001','../log/operatelog.jsp','\0','0160','','电脑版'), ('16','000105','功能管理','0001','../manage/functions.jsp','\0','0135','','电脑版'), ('21','0101','商品管理','01','','\0','0220','','电脑版'), ('22','010101','商品类别管理','0101','../materials/materialcategory.jsp','\0','0230','','电脑版'), ('23','010102','商品档案管理','0101','../materials/material.jsp','\0','0240','','电脑版'), ('24','0102','公司数据管理','01','','\0','0250','','电脑版'), ('25','010201','单位信息','0102','../manage/vendor.jsp','\0','0260','','电脑版'), ('26','010202','部门管理','0102','../manage/depot.jsp','\0','0270','','电脑版'), ('30','0201','其他管理','02','','\0','0310','','电脑版'), ('31','020101','经手人管理','0201','../materials/person.jsp','\0','0312','','电脑版'), ('32','0202','入库管理','02','','\0','0330','','电脑版'), ('33','020201','采购入库','0202','../materials/purchase_in_list.jsp','\0','0340','','电脑版'), ('34','020202','甲供入库','0202','../materials/supply_in_list.jsp','\0','0350','','电脑版'), ('35','020203','租赁入库','0202','../materials/lease_in_list.jsp','\0','0360','','电脑版'), ('36','020204','回收入库','0202','../materials/recover_in_list.jsp','\0','0370','','电脑版'), ('37','020205','调拨入库','0202','../materials/allocation_in_list.jsp','\0','0380','','电脑版'), ('38','0203','出库管理','02','','\0','0390','','电脑版'), ('39','020301','领用出库','0203','../materials/consuming_out_list.jsp','\0','0400','','电脑版'), ('40','020302','调拨出库','0203','../materials/allocation_out_list.jsp','\0','0410','','电脑版'), ('41','020303','销售出库','0203','../materials/sale_out_list.jsp','\0','0420','','电脑版'), ('42','020304','退还出库','0203','../materials/return_out_list.jsp','\0','0430','','电脑版'), ('43','020305','报废出库','0203','../materials/other_out_list.jsp','\0','0430','','电脑版'), ('44','0204','财务管理','02','','\0','0450','','电脑版'), ('45','020401','单据审核','0204','','','0460','','电脑版'), ('46','02040101','采购入库审核','020401','../materials/audit_purchase_in_list.jsp','\0','0470','','电脑版'), ('47','02040102','甲供入库审核','020401','../materials/audit_supply_in_list.jsp','\0','0480','','电脑版'), ('48','02040103','租赁入库审核','020401','../materials/audit_lease_in_list.jsp','\0','0490','','电脑版'), ('49','02040104','调拨出库审核','020401','../materials/audit_allocation_out_list.jsp','\0','0500','','电脑版'), ('50','02040105','领用出库审核','020401','../materials/audit_consuming_out_list.jsp','\0','0510','','电脑版'), ('51','02040106','退还出库审核','020401','../materials/audit_return_out_list.jsp','\0','0520','','电脑版'), ('52','020402','采购定价','0204','../materials/fix_purchase_in_list.jsp','\0','0530','','电脑版'), ('53','020403','租赁定价','0204','../materials/fix_lease_in_list.jsp','\0','0540','','电脑版'), ('54','020404','调拨定价','0204','../materials/fix_allocation_out_list.jsp','\0','0550','','电脑版'), ('55','020405','销售定价','0204','../materials/fix_sale_out_list.jsp','\0','0560','','电脑版'), ('58','0205','报表中心','02','','\0','0590','','电脑版'), ('59','020501','项目进销存报表','0205','../reports/in_out_stock_report.jsp','\0','0600','','电脑版'), ('193','02040107','销售出库审核','020401','../materials/audit_sale_out_list.jsp','\0','0525','','电脑版'), ('194','010204','收支项目','0102','../manage/inOutItem.jsp','\0','0282','','电脑版'), ('195','010205','结算账户','0102','../manage/account.jsp','\0','0283','','电脑版');
INSERT INTO `jsh_inoutitem` VALUES ('1','山山水水','支出','yyyy'), ('5','啊啊啊','收入','ttttttt'), ('7','44454','收入','33333');
INSERT INTO `jsh_log` VALUES ('1722','63','登录系统','192.168.1.104','2016-11-27 13:17:17','0','管理用户:jsh 登录系统','jsh 登录系统'), ('1723','63','登录系统','192.168.1.104','2016-11-27 13:17:30','0','管理用户:jsh 登录系统','jsh 登录系统'), ('1724','63','退出系统','192.168.1.104','2016-11-27 13:17:48','0','管理用户:jsh 退出系统','jsh 退出系统'), ('1725','65','登录系统','192.168.1.104','2016-11-27 13:17:52','0','管理用户:ls 登录系统','ls 登录系统'), ('1726','65','退出系统','192.168.1.104','2016-11-27 13:18:18','0','管理用户:ls 退出系统','ls 退出系统'), ('1727','63','登录系统','192.168.1.104','2016-11-27 13:18:22','0','管理用户:jsh 登录系统','jsh 登录系统'), ('1728','63','更新UserBusiness','192.168.1.104','2016-11-27 13:18:44','0','更新UserBusiness的ID为 6 成功!','更新UserBusiness成功'), ('1729','63','退出系统','192.168.1.104','2016-11-27 13:18:48','0','管理用户:jsh 退出系统','jsh 退出系统'), ('1730','65','登录系统','192.168.1.104','2016-11-27 13:18:53','0','管理用户:ls 登录系统','ls 登录系统');
INSERT INTO `jsh_material` VALUES ('485','1','棉线','A21-4321','米色','码',''), ('487','1','网布','12343','红色','码',''), ('498','2','蕾丝','B123','蓝色','码','');
......
package com.jsh.action.basic;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
......@@ -29,7 +27,6 @@ import com.jsh.model.vo.basic.AppModel;
import com.jsh.service.basic.AppIService;
import com.jsh.service.basic.UserBusinessIService;
import com.jsh.util.common.PageUtil;
//import com.opensymphony.xwork2.ActionContext;
/**
* 应用
* @author ji_sheng_hua
......
......@@ -21,7 +21,10 @@ import com.jsh.model.vo.basic.DepotModel;
import com.jsh.service.basic.DepotIService;
import com.jsh.service.basic.UserBusinessIService;
import com.jsh.util.common.PageUtil;
/**
* 仓库
* @author ji sheng hua
*/
@SuppressWarnings("serial")
public class DepotAction extends BaseAction<DepotModel>
{
......
package com.jsh.action.basic;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.dao.DataAccessException;
import com.jsh.base.BaseAction;
import com.jsh.base.Log;
import com.jsh.model.po.Category;
import com.jsh.model.po.Depot;
import com.jsh.model.po.VisitAccount;
import com.jsh.model.po.Logdetails;
import com.jsh.model.vo.basic.VisitAccountModel;
import com.jsh.service.basic.VisitAccountIService;
import com.jsh.util.common.PageUtil;
@SuppressWarnings("serial")
public class VisitAccountAction extends BaseAction<VisitAccountModel>
{
private VisitAccountIService visitAccountService;
private VisitAccountModel model = new VisitAccountModel();
/**
* 增加回访
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加回访信息方法create()===================");
Boolean flag = false;
try
{
VisitAccount visitAccount = new VisitAccount();
visitAccount.setDepot(new Depot(model.getProjectId()));
visitAccount.setLouHao(model.getLouHao());
visitAccount.setHuHao(model.getHuHao());
visitAccount.setHuiFang(model.getHuiFang());
visitAccount.setLuoShi(model.getLuoShi());
visitAccount.setName(model.getName());
visitAccount.setTel(model.getTel());
visitAccount.setAddTime(new Timestamp(new Date().getTime()));
visitAccountService.create(visitAccount);
//========标识位===========
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
{
visitAccountService.delete(model.getVisitAccountID());
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getVisitAccountID() + " 的回访异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除回访", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除回访ID为 "+ model.getVisitAccountID() + " " + tipMsg + "!", "删除回访" + tipMsg));
Log.infoFileSync("====================结束调用删除回访信息方法delete()================");
return SUCCESS;
}
/**
* 更新回访
* @return
*/
public void update()
{
Boolean flag = false;
try
{
VisitAccount visitAccount = visitAccountService.get(model.getVisitAccountID());
visitAccount.setDepot(new Depot(model.getProjectId()));
visitAccount.setLouHao(model.getLouHao());
visitAccount.setHuHao(model.getHuHao());
visitAccount.setHuiFang(model.getHuiFang());
visitAccount.setLuoShi(model.getLuoShi());
visitAccount.setName(model.getName());
visitAccount.setTel(model.getTel());
visitAccount.setAddTime(new Timestamp(new Date().getTime()));
visitAccountService.update(visitAccount);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改回访ID为 : " + model.getVisitAccountID() + "信息失败", 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.getVisitAccountID() + " " + tipMsg + "!", "更新回访" + tipMsg));
}
/**
* 批量删除指定ID回访
* @return
*/
public String batchDelete()
{
try
{
visitAccountService.batchDelete(model.getVisitAccountIDs());
model.getShowModel().setMsgTip("成功");
//记录操作日志使用
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除回访ID为:" + model.getVisitAccountIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除回访", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除回访ID为 "+ model.getVisitAccountIDs() + " " + tipMsg + "!", "批量删除回访" + tipMsg));
return SUCCESS;
}
/**
* 查找回访信息
* @return
*/
public void findBy()
{
try
{
PageUtil<VisitAccount> pageUtil = new PageUtil<VisitAccount>();
pageUtil.setPageSize(model.getPageSize());
pageUtil.setCurPage(model.getPageNo());
pageUtil.setAdvSearch(getCondition());
visitAccountService.find(pageUtil);
List<VisitAccount> 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(VisitAccount visitAccount:dataList)
{
JSONObject item = new JSONObject();
item.put("Id", visitAccount.getId());
item.put("ProjectId", visitAccount.getDepot().getId());
item.put("ProjectName", visitAccount.getDepot().getName());
item.put("LouHao", visitAccount.getLouHao());
item.put("HuHao", visitAccount.getHuHao());
item.put("HuiFang", visitAccount.getHuiFang());
item.put("LuoShi", visitAccount.getLuoShi());
item.put("Name", visitAccount.getName());
item.put("Tel", visitAccount.getTel());
item.put("AddTime", visitAccount.getAddTime());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
//回写查询结果
toClient(outer.toString());
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找回访信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询回访信息结果异常", e);
}
}
/**
* 拼接搜索条件
* @return
*/
private Map<String,Object> getCondition()
{
/**
* 拼接搜索条件
*/
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("ProjectId_n_eq", model.getProjectId());
condition.put("LouHao_s_like", model.getLouHao());
condition.put("AddTime_s_order", "desc");
return condition;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
public VisitAccountModel getModel()
{
return model;
}
public void setVisitAccountService(VisitAccountIService visitAccountService)
{
this.visitAccountService = visitAccountService;
}
}
......@@ -44,19 +44,19 @@ public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>查找物料类别信息异常", e);
Log.errorFileSync(">>>>>>>>>>>>>查找商品类别信息异常", e);
model.getShowModel().setMsgTip("exceptoin");
}
return SUCCESS;
}
/**
* 增加物料类别
* 增加商品类别
* @return
*/
public void create()
{
Log.infoFileSync("==================开始调用增加物料类别信息方法create()===================");
Log.infoFileSync("==================开始调用增加商品类别信息方法create()===================");
Boolean flag = false;
try
{
......@@ -75,7 +75,7 @@ public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加物料类别信息异常", e);
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加商品类别信息异常", e);
flag = false;
tipMsg = "失败";
tipType = 1;
......@@ -88,23 +88,23 @@ public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>增加物料类别信息回写客户端结果异常", e);
Log.errorFileSync(">>>>>>>>>>>>增加商品类别信息回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "增加物料类别", model.getClientIp(),
logService.create(new Logdetails(getUser(), "增加商品类别", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "增加物料类别名称为 "+ model.getName() + " " + tipMsg + "!", "增加物料类别" + tipMsg));
Log.infoFileSync("==================结束调用增加物料类别方法create()===================");
, tipType, "增加商品类别名称为 "+ model.getName() + " " + tipMsg + "!", "增加商品类别" + tipMsg));
Log.infoFileSync("==================结束调用增加商品类别方法create()===================");
}
/**
* 删除物料类别
* 删除商品类别
* @return
*/
public String delete()
{
Log.infoFileSync("====================开始调用删除物料类别信息方法delete()================");
Log.infoFileSync("====================开始调用删除商品类别信息方法delete()================");
try
{
materialCategoryService.delete(model.getMaterialCategoryID());
......@@ -113,20 +113,20 @@ public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialCategoryID() + " 的物料类别异常", e);
Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialCategoryID() + " 的商品类别异常", e);
tipMsg = "失败";
tipType = 1;
}
model.getShowModel().setMsgTip(tipMsg);
logService.create(new Logdetails(getUser(), "删除物料类别", model.getClientIp(),
logService.create(new Logdetails(getUser(), "删除商品类别", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "删除物料类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "!", "删除物料类别" + tipMsg));
Log.infoFileSync("====================结束调用删除物料类别信息方法delete()================");
, tipType, "删除商品类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "!", "删除商品类别" + tipMsg));
Log.infoFileSync("====================结束调用删除商品类别信息方法delete()================");
return SUCCESS;
}
/**
* 更新物料类别
* 更新商品类别
* @return
*/
public void update()
......@@ -147,7 +147,7 @@ public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改物料类别ID为 : " + model.getMaterialCategoryID() + "信息失败", e);
Log.errorFileSync(">>>>>>>>>>>>>修改商品类别ID为 : " + model.getMaterialCategoryID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
......@@ -160,16 +160,16 @@ public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改物料类别回写客户端结果异常", e);
Log.errorFileSync(">>>>>>>>>>>>修改商品类别回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新物料类别", model.getClientIp(),
logService.create(new Logdetails(getUser(), "更新商品类别", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新物料类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "!", "更新物料类别" + tipMsg));
, tipType, "更新商品类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "!", "更新商品类别" + tipMsg));
}
/**
* 批量删除指定ID物料类别
* 批量删除指定ID商品类别
* @return
*/
public String batchDelete()
......@@ -184,19 +184,19 @@ public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>批量删除物料类别ID为:" + model.getMaterialCategoryIDs() + "信息异常", e);
Log.errorFileSync(">>>>>>>>>>>批量删除商品类别ID为:" + model.getMaterialCategoryIDs() + "信息异常", e);
tipMsg = "失败";
tipType = 1;
}
logService.create(new Logdetails(getUser(), "批量删除物料类别", model.getClientIp(),
logService.create(new Logdetails(getUser(), "批量删除商品类别", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "批量删除物料类别ID为 "+ model.getMaterialCategoryIDs() + " " + tipMsg + "!", "批量删除物料类别" + tipMsg));
, tipType, "批量删除商品类别ID为 "+ model.getMaterialCategoryIDs() + " " + tipMsg + "!", "批量删除商品类别" + tipMsg));
return SUCCESS;
}
/**
* 查找物料类别信息
* 查找商品类别信息
* @return
*/
public void findBy()
......@@ -238,11 +238,11 @@ public class MaterialCategoryAction extends BaseAction<MaterialCategoryModel>
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找物料类别信息异常", e);
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品类别信息异常", e);
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询物料类别信息结果异常", e);
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品类别信息结果异常", e);
}
}
......
package com.jsh.base;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.hibernate.Query;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.jsh.util.common.PageUtil;
import com.jsh.util.common.SearchConditionUtil;
public class BaseDAO<T> extends HibernateDaoSupport implements BaseIDAO<T>
{
protected Class<T> entityClass;
public void setPoJoClass(Class<T> c)
{
this.entityClass = c;
}
protected Class<T> getEntityClass()
{
return this.entityClass;
}
@Override
public Serializable create(T t) throws DataAccessException
{
return this.getHibernateTemplate().save(t);
}
@Override
public void delete(T t) throws DataAccessException
{
this.getHibernateTemplate().delete(t);
}
@Override
public T get(Long objID) throws DataAccessException
{
return (T) this.getHibernateTemplate().get(getEntityClass(), objID);
}
@Override
public void update(T t) throws DataAccessException
{
this.getHibernateTemplate().update(t);
}
@Override
public void batchDelete(String objIDs) throws DataAccessException
{
this.getHibernateTemplate().bulkUpdate("delete from " + getEntityClass().getName() + " where id in ("+ objIDs + ")");
}
@SuppressWarnings("unchecked")
@Override
public void find(PageUtil<T> pageUtil) throws DataAccessException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+
SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
// 分页查询
int pageNo = pageUtil.getCurPage();
int pageSize = pageUtil.getPageSize();
if (0 != pageNo && 0 != pageSize)
{
query.setFirstResult((pageNo - 1) * pageSize);
query.setMaxResults(pageSize);
}
pageUtil.setPageList(query.list());
}
@SuppressWarnings("unchecked")
@Override
public List<T> find(Map<String, Object> conditon)throws DataAccessException
{
return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon));
}
@SuppressWarnings("unchecked")
@Override
public List<T> find(String hql) throws DataAccessException
{
return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ hql);
}
@SuppressWarnings("unchecked")
@Override
public List<T> find(Map<String, Object> conditon, int pageSize, int pageNo)throws DataAccessException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon));
query.setFirstResult((pageNo - 1) * pageSize);
query.setMaxResults(pageSize);
return query.list();
}
@SuppressWarnings("unchecked")
@Override
public List<T> find(String hql, int pageSize, int pageNo)throws DataAccessException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql);
query.setFirstResult((pageNo - 1) * pageSize);
query.setMaxResults(pageSize);
return query.list();
}
@SuppressWarnings("unchecked")
@Override
public Integer countSum(Map<String, Object> conditon)throws DataAccessException
{
List<T> dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon)).list();
return dataList ==null?0:dataList.size();
}
@SuppressWarnings("unchecked")
@Override
public Integer countSum(String hql) throws DataAccessException
{
List<T> dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql).list();
return dataList ==null?0:dataList.size();
}
@Override
public void save(T t) throws DataAccessException
{
this.getHibernateTemplate().save(t);
}
}
package com.jsh.base;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.hibernate.Query;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.jsh.util.common.PageUtil;
import com.jsh.util.common.SearchConditionUtil;
/**
* 基础dao
* @author ji_sheng_hua
*/
public class BaseDAO<T> extends HibernateDaoSupport implements BaseIDAO<T>
{
protected Class<T> entityClass;
public void setPoJoClass(Class<T> c)
{
this.entityClass = c;
}
protected Class<T> getEntityClass()
{
return this.entityClass;
}
@Override
public Serializable create(T t) throws DataAccessException
{
return this.getHibernateTemplate().save(t);
}
@Override
public void delete(T t) throws DataAccessException
{
this.getHibernateTemplate().delete(t);
}
@Override
public T get(Long objID) throws DataAccessException
{
return (T) this.getHibernateTemplate().get(getEntityClass(), objID);
}
@Override
public void update(T t) throws DataAccessException
{
this.getHibernateTemplate().update(t);
}
@Override
public void batchDelete(String objIDs) throws DataAccessException
{
this.getHibernateTemplate().bulkUpdate("delete from " + getEntityClass().getName() + " where id in ("+ objIDs + ")");
}
@SuppressWarnings("unchecked")
@Override
public void find(PageUtil<T> pageUtil) throws DataAccessException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+
SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
// 分页查询
int pageNo = pageUtil.getCurPage();
int pageSize = pageUtil.getPageSize();
if (0 != pageNo && 0 != pageSize)
{
query.setFirstResult((pageNo - 1) * pageSize);
query.setMaxResults(pageSize);
}
pageUtil.setPageList(query.list());
}
@SuppressWarnings("unchecked")
@Override
public List<T> find(Map<String, Object> conditon)throws DataAccessException
{
return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon));
}
@SuppressWarnings("unchecked")
@Override
public List<T> find(String hql) throws DataAccessException
{
return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ hql);
}
@SuppressWarnings("unchecked")
@Override
public List<T> find(Map<String, Object> conditon, int pageSize, int pageNo)throws DataAccessException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon));
query.setFirstResult((pageNo - 1) * pageSize);
query.setMaxResults(pageSize);
return query.list();
}
@SuppressWarnings("unchecked")
@Override
public List<T> find(String hql, int pageSize, int pageNo)throws DataAccessException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql);
query.setFirstResult((pageNo - 1) * pageSize);
query.setMaxResults(pageSize);
return query.list();
}
@SuppressWarnings("unchecked")
@Override
public Integer countSum(Map<String, Object> conditon)throws DataAccessException
{
List<T> dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon)).list();
return dataList ==null?0:dataList.size();
}
@SuppressWarnings("unchecked")
@Override
public Integer countSum(String hql) throws DataAccessException
{
List<T> dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession()
.createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql).list();
return dataList ==null?0:dataList.size();
}
@Override
public void save(T t) throws DataAccessException
{
this.getHibernateTemplate().save(t);
}
}
......@@ -10,7 +10,7 @@ import com.jsh.util.common.PageUtil;
/**
* 常用增删改查操作
* @author jishenghua
* @author ji-sheng-hua
* @param <T>
*/
public interface BaseIDAO<T>
......
......@@ -4,7 +4,7 @@ import org.apache.log4j.Logger;
/**
* 封装log4j日志信息,打印日志信息类
* @author jishenghua
* @author ji/sheng/hua
* @since 2014-01-22
*/
public class Log
......
package com.jsh.dao.basic;
import com.jsh.base.BaseDAO;
import com.jsh.model.po.VisitAccount;
public class VisitAccountDAO extends BaseDAO<VisitAccount> implements VisitAccountIDAO
{
/**
* 设置dao映射基类
* @return
*/
@Override
public Class<VisitAccount> getEntityClass()
{
return VisitAccount.class;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment