Commit 55135aca authored by 季圣华's avatar 季圣华
Browse files

整理代码

parent 46b75fec
......@@ -10,7 +10,7 @@ import com.jsh.util.common.PageUtil;
/**
* 常用增删改查操作
* @author andy
* @author jishenghua
* @param <T>
*/
public interface BaseIDAO<T>
......
......@@ -7,7 +7,7 @@ import java.util.Map;
import org.springframework.dao.DataAccessException;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.Basicuser;
import com.jsh.util.common.PageUtil;
......
......@@ -4,7 +4,7 @@ import org.apache.log4j.Logger;
/**
* 封装log4j日志信息,打印日志信息类
* @author andy
* @author jishenghua
* @since 2014-01-22
*/
public class Log
......
......@@ -2,13 +2,13 @@ package com.jsh.constants.asset;
/**
* 定义资产管理常量
* @author andy
* @author jishenghua
*/
public interface AssetConstants
{
/**
* 公共常量
* @author andy
* @author jishenghua
*/
public class Common
{
......@@ -17,7 +17,7 @@ public interface AssetConstants
/**
* 资产常量--导入导出excel表格业务相关
* @author andy
* @author jishenghua
*/
public class BusinessForExcel
{
......
......@@ -4,7 +4,7 @@ public interface AmsConstants
{
/**
* 定义资产管理公共常量
* @author andy
* @author jishenghua
*/
public class Common
{
......
......@@ -4,7 +4,7 @@ public interface LogModuleConstants
{
/**
* 系统管理模块名称定义
* @author andy
* @author jishenghua
*/
public class ManageModuleNameCode
{
......@@ -31,7 +31,7 @@ public interface LogModuleConstants
/**
* 资产管理模块名称定义
* @author andy
* @author jishenghua
*/
public class AssetModuleNameCode
{
......@@ -53,7 +53,7 @@ public interface LogModuleConstants
/**
* 日志管理模块名称定义
* @author andy
* @author jishenghua
*/
public class LogModuleNameCode
{
......
......@@ -3,7 +3,7 @@ package com.jsh.dao.asset;
import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.Asset;
import com.jsh.util.common.PageUtil;
import com.jsh.util.common.SearchConditionUtil;
......@@ -12,7 +12,7 @@ public class ReportDAO extends HibernateDaoSupport implements ReportIDAO
{
@SuppressWarnings("unchecked")
@Override
public void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws AmsException
public void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws JshException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(" + reportType +") as dataSum, " + reportName + " from Asset asset where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
......
package com.jsh.dao.asset;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.Asset;
import com.jsh.util.common.PageUtil;
......@@ -10,7 +10,7 @@ public interface ReportIDAO
* 查找资产列表
* @param pageUtil 分页工具类
* @param reportType 报表统计字段
* @throws AmsException
* @throws JshException
*/
void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws AmsException;
void find(PageUtil<Asset> pageUtil,String reportType,String reportName) throws JshException;
}
......@@ -3,7 +3,7 @@ package com.jsh.dao.basic;
import org.hibernate.Query;
import com.jsh.base.BaseDAO;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.common.PageUtil;
......@@ -23,7 +23,7 @@ public class UserBusinessDAO extends BaseDAO<UserBusiness> implements UserBusine
@SuppressWarnings("unchecked")
@Override
public void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws AmsException
public void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws JshException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(id),sum(id) from UserBusiness userBusiness where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
......
package com.jsh.dao.basic;
import com.jsh.base.BaseIDAO;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.common.PageUtil;
......@@ -10,5 +10,5 @@ public interface UserBusinessIDAO extends BaseIDAO<UserBusiness>
/*
* 测试hql语句
*/
void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws AmsException;
void find(PageUtil<UserBusiness> pageUtil,String ceshi) throws JshException;
}
......@@ -3,7 +3,7 @@ package com.jsh.dao.materials;
import org.hibernate.Query;
import com.jsh.base.BaseDAO;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.common.PageUtil;
......@@ -23,7 +23,7 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO
@SuppressWarnings("unchecked")
@Override
public void find(PageUtil<DepotHead> pageUtil,String maxid) throws AmsException
public void find(PageUtil<DepotHead> pageUtil,String maxid) throws JshException
{
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from DepotHead depotHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
pageUtil.setTotalCount(query.list().size());
......
package com.jsh.dao.materials;
import com.jsh.base.BaseIDAO;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.common.PageUtil;
......@@ -11,5 +11,5 @@ public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
/*
* 获取MaxId
*/
void find(PageUtil<DepotHead> pageUtil,String maxid) throws AmsException;
void find(PageUtil<DepotHead> pageUtil,String maxid) throws JshException;
}
......@@ -3,7 +3,7 @@ package com.jsh.dao.materials;
import org.hibernate.Query;
import com.jsh.base.BaseDAO;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.DepotItem;
import com.jsh.util.common.PageUtil;
......@@ -23,7 +23,7 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
@SuppressWarnings("unchecked")
@Override
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws AmsException
public void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId,String MonthTime,Boolean isPrev) throws JshException
{
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
Query query;
......@@ -40,7 +40,7 @@ public class DepotItemDAO extends BaseDAO<DepotItem> implements DepotItemIDAO
@SuppressWarnings("unchecked")
@Override
public void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws AmsException
public void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws JshException
{
//多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便
Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery("select * from jsh_depotitem where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
......
package com.jsh.dao.materials;
import com.jsh.base.BaseIDAO;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.DepotItem;
import com.jsh.util.common.PageUtil;
public interface DepotItemIDAO extends BaseIDAO<DepotItem>
{
void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws AmsException;
void findByType(PageUtil<DepotItem> pageUtil,String type,Long MId, String MonthTime,Boolean isPrev) throws JshException;
void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws AmsException;
void findOrderByMaterial(PageUtil<DepotItem> pageUtil) throws JshException;
}
......@@ -3,59 +3,59 @@ package com.jsh.exception;
/**
* @title: 平台异常基类
* @description: 用于包装一些异常信息,打印日志等服务
* @author andy
* @author jishenghua
* @since: 2014-01-24
*/
@SuppressWarnings("serial")
public class AmsException extends Exception
public class JshException extends Exception
{
public long errorCode = -1;
public String message ;
public AmsException()
public JshException()
{
super();
}
public AmsException(String message)
public JshException(String message)
{
super(message);
this.message = message;
}
public AmsException(String message, Throwable cause)
public JshException(String message, Throwable cause)
{
super(message, cause);
this.message = message;
}
public AmsException(Throwable cause)
public JshException(Throwable cause)
{
super(cause);
}
public AmsException(long errorCode)
public JshException(long errorCode)
{
super();
this.errorCode = errorCode;
}
public AmsException(String message, long errorCode)
public JshException(String message, long errorCode)
{
super(message);
this.errorCode = errorCode;
this.message = message;
}
public AmsException(String message, long errorCode, Throwable cause)
public JshException(String message, long errorCode, Throwable cause)
{
super(message, cause);
this.errorCode = errorCode;
this.message = message;
}
public AmsException(long errorCode, Throwable cause)
public JshException(long errorCode, Throwable cause)
{
super(cause);
this.errorCode = errorCode;
......
......@@ -15,7 +15,7 @@ import javax.servlet.http.HttpSession;
/**
* 用户登录session处理类
* 过滤session是否超时
* @author andy
* @author jishenghua
* @version [版本号, 2012-3-6]
* @see [相关类/方法]
* @since
......
......@@ -18,7 +18,7 @@
</column>
</property>
<property name="password" type="java.lang.String">
<column name="password" length="30" not-null="true">
<column name="password" length="50" not-null="true">
<comment>登陆密码</comment>
</column>
</property>
......
package com.jsh.model.vo.materials;
import java.io.Serializable;
import com.sun.jmx.snmp.Timestamp;
@SuppressWarnings("serial")
public class DepotHeadModel implements Serializable
......
......@@ -4,7 +4,7 @@ import java.io.File;
import java.io.InputStream;
import com.jsh.base.BaseIService;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.Asset;
import com.jsh.util.common.PageUtil;
......@@ -14,7 +14,7 @@ public interface AssetIService extends BaseIService<Asset>
* 导出信息
* @return
*/
InputStream exmportExcel(String isAllPage,PageUtil<Asset> pageUtil)throws AmsException;
InputStream exmportExcel(String isAllPage,PageUtil<Asset> pageUtil)throws JshException;
/**
* 导入资产excel文件--表格格式 同 媒资列表 || 资产名称-资产类型-单价-用户-购买时间-状态-位置-资产编号-序列号-有效日期-保修日期-供应商-标签-描述
......@@ -24,7 +24,7 @@ public interface AssetIService extends BaseIService<Asset>
* @param assetFile excel表格文件
* @param isCheck 是否检查 0--手工确定 1--直接导入数据库中
* @return 错误的表格数据
* @throws AmsException
* @throws JshException
*/
InputStream importExcel(File assetFile,int isCheck)throws AmsException;
InputStream importExcel(File assetFile,int isCheck)throws JshException;
}
......@@ -39,7 +39,7 @@ import com.jsh.dao.basic.AssetNameIDAO;
import com.jsh.dao.basic.CategoryIDAO;
import com.jsh.dao.basic.SupplierIDAO;
import com.jsh.dao.basic.UserIDAO;
import com.jsh.exception.AmsException;
import com.jsh.exception.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.po.Assetname;
import com.jsh.model.po.Category;
......@@ -74,7 +74,7 @@ public class AssetService extends BaseService<Asset> implements AssetIService
* 导出Excel表格
*/
@Override
public InputStream exmportExcel(String isAllPage,PageUtil<Asset> pageUtil)throws AmsException
public InputStream exmportExcel(String isAllPage,PageUtil<Asset> pageUtil)throws JshException
{
try
{
......@@ -97,12 +97,12 @@ public class AssetService extends BaseService<Asset> implements AssetIService
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e);
throw new AmsException("export asset info to excel exception",e);
throw new JshException("export asset info to excel exception",e);
}
}
@Override
public InputStream importExcel(File assetFile,int isCheck) throws AmsException
public InputStream importExcel(File assetFile,int isCheck) throws JshException
{
//全局变量--每次调用前需要清空数据
mapData.clear();
......@@ -129,10 +129,10 @@ public class AssetService extends BaseService<Asset> implements AssetIService
/**
* 初始加载系统基础数据--导入过程中,不用频繁查询数据库内容,影响系统性能。
* @throws AmsException
* @throws JshException
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private void loadSystemData()throws AmsException
private void loadSystemData()throws JshException
{
PageUtil pageUtil = new PageUtil();
pageUtil.setPageSize(0);
......
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