Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
f01f4f21
Commit
f01f4f21
authored
Oct 30, 2016
by
季圣华
Browse files
初始化项目2
parent
238bdf9c
Changes
206
Hide whitespace changes
Inline
Side-by-side
src/com/jsh/service/basic/RoleService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.basic.RoleIDAO
;
import
com.jsh.dao.basic.UserBusinessIDAO
;
import
com.jsh.model.po.Role
;
public
class
RoleService
extends
BaseService
<
Role
>
implements
RoleIService
{
@SuppressWarnings
(
"unused"
)
private
RoleIDAO
roleDao
;
@SuppressWarnings
(
"unused"
)
private
UserBusinessIDAO
userBusinessDao
;
public
void
setRoleDao
(
RoleIDAO
roleDao
)
{
this
.
roleDao
=
roleDao
;
}
public
void
setUserBusinessDao
(
UserBusinessIDAO
userBusinessDao
)
{
this
.
userBusinessDao
=
userBusinessDao
;
}
@Override
protected
Class
<
Role
>
getEntityClass
()
{
return
Role
.
class
;
}
}
src/com/jsh/service/basic/SupplierIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.Supplier
;
public
interface
SupplierIService
extends
BaseIService
<
Supplier
>
{
}
src/com/jsh/service/basic/SupplierService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.basic.SupplierIDAO
;
import
com.jsh.model.po.Supplier
;
public
class
SupplierService
extends
BaseService
<
Supplier
>
implements
SupplierIService
{
@SuppressWarnings
(
"unused"
)
private
SupplierIDAO
supplierDao
;
public
void
setSupplierDao
(
SupplierIDAO
supplierDao
)
{
this
.
supplierDao
=
supplierDao
;
}
/**
* 设置映射基类
* @return
*/
@Override
protected
Class
<
Supplier
>
getEntityClass
()
{
return
Supplier
.
class
;
}
}
src/com/jsh/service/basic/UserBusinessIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
com.jsh.base.BaseIService
;
import
com.jsh.exception.AmsException
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.util.common.PageUtil
;
public
interface
UserBusinessIService
extends
BaseIService
<
UserBusiness
>
{
/*
* 测试一下自定义hql语句
*/
void
find
(
PageUtil
<
UserBusiness
>
userBusiness
,
String
ceshi
)
throws
AmsException
;
}
src/com/jsh/service/basic/UserBusinessService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.basic.UserBusinessIDAO
;
import
com.jsh.exception.AmsException
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.util.common.PageUtil
;
public
class
UserBusinessService
extends
BaseService
<
UserBusiness
>
implements
UserBusinessIService
{
@SuppressWarnings
(
"unused"
)
private
UserBusinessIDAO
userBusinessDao
;
public
void
setUserBusinessDao
(
UserBusinessIDAO
userBusinessDao
)
{
this
.
userBusinessDao
=
userBusinessDao
;
}
@Override
protected
Class
<
UserBusiness
>
getEntityClass
()
{
return
UserBusiness
.
class
;
}
@Override
public
void
find
(
PageUtil
<
UserBusiness
>
pageUtil
,
String
ceshi
)
throws
AmsException
{
userBusinessDao
.
find
(
pageUtil
,
ceshi
);
}
}
src/com/jsh/service/basic/UserIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
com.jsh.base.BaseIService
;
import
com.jsh.exception.AmsException
;
import
com.jsh.model.po.Basicuser
;
public
interface
UserIService
extends
BaseIService
<
Basicuser
>
{
/**
* 判断用户名是否符合登录条件
* @param username 用户名 String password
* @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常
*/
int
validateUser
(
String
username
,
String
password
)
throws
AmsException
;
/**
* 获取用户信息
* @param username
* @return 用户信息
* @throws AmsException
*/
public
Basicuser
getUser
(
String
username
)
throws
AmsException
;
/**
* 检查用户名称是否存在
* @param field 用户属性
* @param username 用户名称
* @param userID 供应商ID
* @return true==存在重名 false==不存在
* @throws AmsException
*/
Boolean
checkIsNameExist
(
String
field
,
String
username
,
Long
userID
)
throws
AmsException
;
}
src/com/jsh/service/basic/UserService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.jsh.base.BaseService
;
import
com.jsh.base.Log
;
import
com.jsh.constants.common.ExceptionCodeConstants
;
import
com.jsh.dao.basic.UserBusinessIDAO
;
import
com.jsh.dao.basic.UserIDAO
;
import
com.jsh.exception.AmsException
;
import
com.jsh.model.po.Basicuser
;
import
com.jsh.util.common.PageUtil
;
public
class
UserService
extends
BaseService
<
Basicuser
>
implements
UserIService
{
private
PageUtil
<
Basicuser
>
pageUtil
=
new
PageUtil
<
Basicuser
>();
private
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
private
UserIDAO
userDao
;
@Override
public
int
validateUser
(
String
username
,
String
password
)
throws
AmsException
{
try
{
//全局变量 每次使用前清除
condition
.
clear
();
/**默认是可以登录的*/
List
<
Basicuser
>
list
=
null
;
try
{
condition
.
put
(
"loginame_s_eq"
,
username
);
pageUtil
.
setAdvSearch
(
condition
);
userDao
.
find
(
pageUtil
);
list
=
pageUtil
.
getPageList
();
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>访问验证用户姓名是否存在后台信息异常"
,
e
);
return
ExceptionCodeConstants
.
UserExceptionCode
.
USER_ACCESS_EXCEPTION
;
}
if
(
null
!=
list
&&
list
.
size
()
==
0
)
return
ExceptionCodeConstants
.
UserExceptionCode
.
USER_NOT_EXIST
;
try
{
condition
.
put
(
"loginame_s_eq"
,
username
);
condition
.
put
(
"password_s_eq"
,
password
);
pageUtil
.
setAdvSearch
(
condition
);
userDao
.
find
(
pageUtil
);
list
=
pageUtil
.
getPageList
();
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>访问验证用户密码后台信息异常"
,
e
);
return
ExceptionCodeConstants
.
UserExceptionCode
.
USER_ACCESS_EXCEPTION
;
}
if
(
null
!=
list
&&
list
.
size
()
==
0
)
return
ExceptionCodeConstants
.
UserExceptionCode
.
USER_PASSWORD_ERROR
;
return
ExceptionCodeConstants
.
UserExceptionCode
.
USER_CONDITION_FIT
;
}
catch
(
Exception
e
)
{
throw
new
AmsException
(
"unknown exception"
,
e
);
}
}
@Override
public
Basicuser
getUser
(
String
username
)
throws
AmsException
{
//全局变量 每次使用前清除
condition
.
clear
();
condition
.
put
(
"loginame_s_eq"
,
username
);
pageUtil
.
setAdvSearch
(
condition
);
userDao
.
find
(
pageUtil
);
List
<
Basicuser
>
list
=
pageUtil
.
getPageList
();
if
(
null
!=
list
&&
list
.
size
()
>
0
)
return
list
.
get
(
0
);
else
throw
new
AmsException
(
"no username exist"
);
}
@Override
public
Boolean
checkIsNameExist
(
String
field
,
String
username
,
Long
userID
)
throws
AmsException
{
condition
.
clear
();
condition
.
put
(
field
+
"_s_eq"
,
username
);
condition
.
put
(
"id_n_neq"
,
userID
);
pageUtil
.
setAdvSearch
(
condition
);
userDao
.
find
(
pageUtil
);
List
<
Basicuser
>
dataList
=
pageUtil
.
getPageList
();
if
(
null
!=
dataList
&&
dataList
.
size
()
>
0
)
return
true
;
return
false
;
}
//==============spring注入等公共方法,与业务无关=========================
public
void
setUserDao
(
UserIDAO
userDao
)
{
this
.
userDao
=
userDao
;
}
@Override
protected
Class
<
Basicuser
>
getEntityClass
()
{
return
Basicuser
.
class
;
}
}
src/com/jsh/service/basic/VisitAccountIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.VisitAccount
;
public
interface
VisitAccountIService
extends
BaseIService
<
VisitAccount
>
{
}
src/com/jsh/service/basic/VisitAccountService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.basic
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.basic.VisitAccountIDAO
;
import
com.jsh.model.po.VisitAccount
;
public
class
VisitAccountService
extends
BaseService
<
VisitAccount
>
implements
VisitAccountIService
{
@SuppressWarnings
(
"unused"
)
private
VisitAccountIDAO
visitAccountDao
;
public
void
setVisitAccountDao
(
VisitAccountIDAO
visitAccountDao
)
{
this
.
visitAccountDao
=
visitAccountDao
;
}
@Override
protected
Class
<
VisitAccount
>
getEntityClass
()
{
return
VisitAccount
.
class
;
}
}
src/com/jsh/service/materials/BuildingIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.Building
;
public
interface
BuildingIService
extends
BaseIService
<
Building
>
{
}
src/com/jsh/service/materials/BuildingService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.materials.BuildingIDAO
;
import
com.jsh.model.po.Building
;
public
class
BuildingService
extends
BaseService
<
Building
>
implements
BuildingIService
{
@SuppressWarnings
(
"unused"
)
private
BuildingIDAO
buildingDao
;
public
void
setBuildingDao
(
BuildingIDAO
buildingDao
)
{
this
.
buildingDao
=
buildingDao
;
}
@Override
protected
Class
<
Building
>
getEntityClass
()
{
return
Building
.
class
;
}
}
src/com/jsh/service/materials/DepotHeadIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseIService
;
import
com.jsh.exception.AmsException
;
import
com.jsh.model.po.DepotHead
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.util.common.PageUtil
;
public
interface
DepotHeadIService
extends
BaseIService
<
DepotHead
>
{
/*
* 获取MaxId
*/
void
find
(
PageUtil
<
DepotHead
>
depotHead
,
String
maxid
)
throws
AmsException
;
}
src/com/jsh/service/materials/DepotHeadService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.materials.DepotHeadIDAO
;
import
com.jsh.exception.AmsException
;
import
com.jsh.model.po.DepotHead
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.util.common.PageUtil
;
public
class
DepotHeadService
extends
BaseService
<
DepotHead
>
implements
DepotHeadIService
{
@SuppressWarnings
(
"unused"
)
private
DepotHeadIDAO
depotHeadDao
;
public
void
setDepotHeadDao
(
DepotHeadIDAO
depotHeadDao
)
{
this
.
depotHeadDao
=
depotHeadDao
;
}
@Override
protected
Class
<
DepotHead
>
getEntityClass
()
{
return
DepotHead
.
class
;
}
@Override
public
void
find
(
PageUtil
<
DepotHead
>
pageUtil
,
String
maxid
)
throws
AmsException
{
depotHeadDao
.
find
(
pageUtil
,
maxid
);
}
}
src/com/jsh/service/materials/DepotItemIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
java.io.InputStream
;
import
java.util.List
;
import
net.sf.json.JSONArray
;
import
com.jsh.base.BaseIService
;
import
com.jsh.exception.AmsException
;
import
com.jsh.model.po.Asset
;
import
com.jsh.model.po.DepotHead
;
import
com.jsh.model.po.DepotItem
;
import
com.jsh.util.common.PageUtil
;
public
interface
DepotItemIService
extends
BaseIService
<
DepotItem
>
{
void
findByType
(
PageUtil
<
DepotItem
>
depotItem
,
String
type
,
Long
MId
,
String
MonthTime
,
Boolean
isPrev
)
throws
AmsException
;
void
findOrderByMaterial
(
PageUtil
<
DepotItem
>
depotItem
)
throws
AmsException
;
/**
* 导出信息
* @return
*/
InputStream
exmportExcel
(
String
isAllPage
,
JSONArray
dataArray
)
throws
AmsException
;
}
src/com/jsh/service/materials/DepotItemService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.text.DecimalFormat
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
jxl.Workbook
;
import
jxl.write.Label
;
import
jxl.write.WritableSheet
;
import
jxl.write.WritableWorkbook
;
import
com.jsh.base.BaseService
;
import
com.jsh.base.Log
;
import
com.jsh.constants.asset.AssetConstants
;
import
com.jsh.dao.materials.DepotItemIDAO
;
import
com.jsh.exception.AmsException
;
import
com.jsh.model.po.Asset
;
import
com.jsh.model.po.DepotHead
;
import
com.jsh.model.po.DepotItem
;
import
com.jsh.util.common.PageUtil
;
import
com.jsh.util.common.Tools
;
public
class
DepotItemService
extends
BaseService
<
DepotItem
>
implements
DepotItemIService
{
@SuppressWarnings
(
"unused"
)
private
DepotItemIDAO
depotItemDao
;
public
void
setDepotItemDao
(
DepotItemIDAO
depotItemDao
)
{
this
.
depotItemDao
=
depotItemDao
;
}
@Override
protected
Class
<
DepotItem
>
getEntityClass
()
{
return
DepotItem
.
class
;
}
@Override
public
void
findByType
(
PageUtil
<
DepotItem
>
pageUtil
,
String
type
,
Long
MId
,
String
MonthTime
,
Boolean
isPrev
)
throws
AmsException
{
depotItemDao
.
findByType
(
pageUtil
,
type
,
MId
,
MonthTime
,
isPrev
);
}
@Override
public
void
findOrderByMaterial
(
PageUtil
<
DepotItem
>
pageUtil
)
throws
AmsException
{
depotItemDao
.
findOrderByMaterial
(
pageUtil
);
}
/**
* 导出Excel表格
*/
@Override
public
InputStream
exmportExcel
(
String
isAllPage
,
JSONArray
dataArray
)
throws
AmsException
{
try
{
//将OutputStream转化为InputStream
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
putDataOnOutputStream
(
out
,
dataArray
);
return
new
ByteArrayInputStream
(
out
.
toByteArray
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常"
,
e
);
throw
new
AmsException
(
"export asset info to excel exception"
,
e
);
}
}
/**
* 生成excel表格
* @param os
*/
@SuppressWarnings
(
"deprecation"
)
private
void
putDataOnOutputStream
(
OutputStream
os
,
JSONArray
dataArray
)
{
WritableWorkbook
workbook
=
null
;
try
{
workbook
=
Workbook
.
createWorkbook
(
os
);
WritableSheet
sheet
=
workbook
.
createSheet
(
"进销存报表"
,
0
);
//增加列头
int
[]
colunmWidth
=
{
10
,
10
,
10
,
10
,
15
,
15
,
15
,
15
,
15
};
String
[]
colunmName
=
{
"名称"
,
"款号"
,
"颜色"
,
"单价"
,
"上月结存数量"
,
"入库数量"
,
"出库数量"
,
"本月结存数量"
,
"结存金额"
};
for
(
int
i
=
0
;
i
<
colunmWidth
.
length
;
i
++)
{
sheet
.
setColumnView
(
i
,
colunmWidth
[
i
]);
sheet
.
addCell
(
new
Label
(
i
,
0
,
colunmName
[
i
]));
}
if
(
null
!=
dataArray
&&
dataArray
.
size
()
>
0
)
{
for
(
int
j
=
0
;
j
<
dataArray
.
size
();
j
++){
JSONObject
jo
=
JSONObject
.
fromObject
(
dataArray
.
get
(
j
));
sheet
.
addCell
(
new
Label
(
0
,
j
+
1
,
jo
.
getString
(
"MaterialName"
)));
sheet
.
addCell
(
new
Label
(
1
,
j
+
1
,
jo
.
getString
(
"MaterialModel"
)));
sheet
.
addCell
(
new
Label
(
2
,
j
+
1
,
jo
.
getString
(
"MaterialColor"
)));
sheet
.
addCell
(
new
Label
(
3
,
j
+
1
,
jo
.
getString
(
"UnitPrice"
)));
sheet
.
addCell
(
new
Label
(
4
,
j
+
1
,
jo
.
getString
(
"prevSum"
)));
sheet
.
addCell
(
new
Label
(
5
,
j
+
1
,
jo
.
getString
(
"InSum"
)));
sheet
.
addCell
(
new
Label
(
6
,
j
+
1
,
jo
.
getString
(
"OutSum"
)));
sheet
.
addCell
(
new
Label
(
7
,
j
+
1
,
jo
.
getString
(
"thisSum"
)));
double
d
=
Double
.
parseDouble
(
jo
.
getString
(
"thisAllPrice"
).
toString
());
String
s1
=
String
.
format
(
"%.2f"
,
d
);
sheet
.
addCell
(
new
Label
(
8
,
j
+
1
,
s1
));
}
}
workbook
.
write
();
workbook
.
close
();
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常"
,
e
);
}
}
}
src/com/jsh/service/materials/MaterialCategoryIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.MaterialCategory
;
public
interface
MaterialCategoryIService
extends
BaseIService
<
MaterialCategory
>
{
}
src/com/jsh/service/materials/MaterialCategoryService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.materials.MaterialCategoryIDAO
;
import
com.jsh.model.po.MaterialCategory
;
public
class
MaterialCategoryService
extends
BaseService
<
MaterialCategory
>
implements
MaterialCategoryIService
{
@SuppressWarnings
(
"unused"
)
private
MaterialCategoryIDAO
materialCategoryDao
;
public
void
setMaterialCategoryDao
(
MaterialCategoryIDAO
materialCategoryDao
)
{
this
.
materialCategoryDao
=
materialCategoryDao
;
}
@Override
protected
Class
<
MaterialCategory
>
getEntityClass
()
{
return
MaterialCategory
.
class
;
}
}
src/com/jsh/service/materials/MaterialIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.Material
;
public
interface
MaterialIService
extends
BaseIService
<
Material
>
{
}
src/com/jsh/service/materials/MaterialService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.materials.MaterialIDAO
;
import
com.jsh.model.po.Material
;
public
class
MaterialService
extends
BaseService
<
Material
>
implements
MaterialIService
{
@SuppressWarnings
(
"unused"
)
private
MaterialIDAO
materialDao
;
public
void
setMaterialDao
(
MaterialIDAO
materialDao
)
{
this
.
materialDao
=
materialDao
;
}
@Override
protected
Class
<
Material
>
getEntityClass
()
{
return
Material
.
class
;
}
}
src/com/jsh/service/materials/PersonIService.java
0 → 100644
View file @
f01f4f21
package
com.jsh.service.materials
;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.Person
;
public
interface
PersonIService
extends
BaseIService
<
Person
>
{
}
Prev
1
…
6
7
8
9
10
11
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment