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
07259995
Commit
07259995
authored
Apr 07, 2018
by
AlanGao
Browse files
update
parent
458409b4
Changes
205
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/service/basic/FunctionsService.java
View file @
07259995
...
...
@@ -5,27 +5,24 @@ import com.jsh.dao.basic.FunctionsIDAO;
import
com.jsh.dao.basic.UserBusinessIDAO
;
import
com.jsh.model.po.Functions
;
public
class
FunctionsService
extends
BaseService
<
Functions
>
implements
FunctionsIService
{
@SuppressWarnings
(
"unused"
)
private
FunctionsIDAO
functionsDao
;
@SuppressWarnings
(
"unused"
)
private
UserBusinessIDAO
userBusinessDao
;
public
class
FunctionsService
extends
BaseService
<
Functions
>
implements
FunctionsIService
{
@SuppressWarnings
(
"unused"
)
private
FunctionsIDAO
functionsDao
;
@SuppressWarnings
(
"unused"
)
private
UserBusinessIDAO
userBusinessDao
;
public
void
setFunctionsDao
(
FunctionsIDAO
functionsDao
)
{
this
.
functionsDao
=
functionsDao
;
}
public
void
setUserBusinessDao
(
UserBusinessIDAO
userBusinessDao
)
{
this
.
userBusinessDao
=
userBusinessDao
;
}
@Override
protected
Class
<
Functions
>
getEntityClass
()
{
return
Functions
.
class
;
}
public
void
setFunctionsDao
(
FunctionsIDAO
functionsDao
)
{
this
.
functionsDao
=
functionsDao
;
}
public
void
setUserBusinessDao
(
UserBusinessIDAO
userBusinessDao
)
{
this
.
userBusinessDao
=
userBusinessDao
;
}
@Override
protected
Class
<
Functions
>
getEntityClass
()
{
return
Functions
.
class
;
}
}
src/main/java/com/jsh/service/basic/InOutItemIService.java
View file @
07259995
...
...
@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.InOutItem
;
public
interface
InOutItemIService
extends
BaseIService
<
InOutItem
>
{
public
interface
InOutItemIService
extends
BaseIService
<
InOutItem
>
{
}
src/main/java/com/jsh/service/basic/InOutItemService.java
View file @
07259995
...
...
@@ -4,19 +4,16 @@ import com.jsh.base.BaseService;
import
com.jsh.dao.basic.InOutItemIDAO
;
import
com.jsh.model.po.InOutItem
;
public
class
InOutItemService
extends
BaseService
<
InOutItem
>
implements
InOutItemIService
{
public
class
InOutItemService
extends
BaseService
<
InOutItem
>
implements
InOutItemIService
{
@SuppressWarnings
(
"unused"
)
private
InOutItemIDAO
inOutItemDao
;
public
void
setInOutItemDao
(
InOutItemIDAO
inOutItemDao
)
{
public
void
setInOutItemDao
(
InOutItemIDAO
inOutItemDao
)
{
this
.
inOutItemDao
=
inOutItemDao
;
}
@Override
protected
Class
<
InOutItem
>
getEntityClass
()
{
protected
Class
<
InOutItem
>
getEntityClass
()
{
return
InOutItem
.
class
;
}
...
...
src/main/java/com/jsh/service/basic/LogIService.java
View file @
07259995
package
com.jsh.service.basic
;
import
com.jsh.base.BaseIService
;
import
com.jsh.util.JshException
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.util.JshException
;
public
interface
LogIService
extends
BaseIService
<
Logdetails
>
{
/**
* 增加
* @param t 对象
* @throws JshException
*/
@Override
void
save
(
Logdetails
t
);
public
interface
LogIService
extends
BaseIService
<
Logdetails
>
{
/**
* 增加
*
* @param t 对象
* @throws JshException
*/
@Override
void
save
(
Logdetails
t
);
}
src/main/java/com/jsh/service/basic/LogService.java
View file @
07259995
...
...
@@ -5,32 +5,25 @@ import com.jsh.base.Log;
import
com.jsh.dao.basic.LogIDAO
;
import
com.jsh.model.po.Logdetails
;
public
class
LogService
extends
BaseService
<
Logdetails
>
implements
LogIService
{
public
class
LogService
extends
BaseService
<
Logdetails
>
implements
LogIService
{
@SuppressWarnings
(
"unused"
)
private
LogIDAO
logDao
;
private
LogIDAO
logDao
;
public
void
setLogDao
(
LogIDAO
logDao
)
{
public
void
setLogDao
(
LogIDAO
logDao
)
{
this
.
logDao
=
logDao
;
}
@Override
protected
Class
<
Logdetails
>
getEntityClass
()
{
return
Logdetails
.
class
;
}
@Override
public
void
save
(
Logdetails
t
)
{
try
{
super
.
save
(
t
);
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>创建操作日志异常"
,
e
);
}
}
@Override
protected
Class
<
Logdetails
>
getEntityClass
()
{
return
Logdetails
.
class
;
}
@Override
public
void
save
(
Logdetails
t
)
{
try
{
super
.
save
(
t
);
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>创建操作日志异常"
,
e
);
}
}
}
\ No newline at end of file
src/main/java/com/jsh/service/basic/RoleIService.java
View file @
07259995
...
...
@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.Role
;
public
interface
RoleIService
extends
BaseIService
<
Role
>
{
public
interface
RoleIService
extends
BaseIService
<
Role
>
{
}
src/main/java/com/jsh/service/basic/RoleService.java
View file @
07259995
...
...
@@ -5,26 +5,23 @@ 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
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
;
}
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/main/java/com/jsh/service/basic/SupplierIService.java
View file @
07259995
...
...
@@ -8,11 +8,10 @@ import com.jsh.util.PageUtil;
import
java.io.File
;
import
java.io.InputStream
;
public
interface
SupplierIService
extends
BaseIService
<
Supplier
>
{
public
void
batchSetEnable
(
Boolean
enable
,
String
supplierIDs
);
public
interface
SupplierIService
extends
BaseIService
<
Supplier
>
{
public
void
batchSetEnable
(
Boolean
enable
,
String
supplierIDs
);
public
InputStream
exmportExcel
(
String
isAllPage
,
PageUtil
<
Supplier
>
pageUtil
)
throws
JshException
;
public
InputStream
exmportExcel
(
String
isAllPage
,
PageUtil
<
Supplier
>
pageUtil
)
throws
JshException
;
public
InputStream
importExcel
(
File
assetFile
)
throws
JshException
;
public
InputStream
importExcel
(
File
assetFile
)
throws
JshException
;
}
src/main/java/com/jsh/service/basic/SupplierService.java
View file @
07259995
...
...
@@ -5,7 +5,10 @@ import com.jsh.base.Log;
import
com.jsh.dao.basic.SupplierIDAO
;
import
com.jsh.dao.basic.UserBusinessIDAO
;
import
com.jsh.model.po.Supplier
;
import
com.jsh.util.*
;
import
com.jsh.util.JshException
;
import
com.jsh.util.PageUtil
;
import
com.jsh.util.SupplierConstants
;
import
com.jsh.util.Tools
;
import
jxl.Workbook
;
import
jxl.format.Colour
;
import
jxl.write.*
;
...
...
@@ -18,442 +21,417 @@ import java.io.*;
import
java.lang.Boolean
;
import
java.util.*
;
public
class
SupplierService
extends
BaseService
<
Supplier
>
implements
SupplierIService
{
@SuppressWarnings
(
"unused"
)
private
SupplierIDAO
supplierDao
;
@SuppressWarnings
(
"unused"
)
private
UserBusinessIDAO
userBusinessDao
;
public
class
SupplierService
extends
BaseService
<
Supplier
>
implements
SupplierIService
{
/**
* 初始化加载所有系统基础数据
*/
@SuppressWarnings
({
"rawtypes"
})
private
static
Map
<
String
,
List
>
mapData
=
new
HashMap
<
String
,
List
>();
/**
* 错误的表格数据
*/
private
static
List
<
Supplier
>
wrongData
=
new
ArrayList
<
Supplier
>();
@SuppressWarnings
(
"unused"
)
private
SupplierIDAO
supplierDao
;
@SuppressWarnings
(
"unused"
)
private
UserBusinessIDAO
userBusinessDao
;
/**
* 设置映射基类
* @return
*/
@Override
protected
Class
<
Supplier
>
getEntityClass
()
{
return
Supplier
.
class
;
}
public
void
setSupplierDao
(
SupplierIDAO
supplierDao
)
{
this
.
supplierDao
=
supplierDao
;
}
/**
* 设置映射基类
*
* @return
*/
@Override
protected
Class
<
Supplier
>
getEntityClass
()
{
return
Supplier
.
class
;
}
public
void
set
UserBusinessDao
(
UserBusinessIDAO
userBusiness
Dao
)
{
this
.
userBusinessDao
=
userBusiness
Dao
;
}
public
void
set
SupplierDao
(
SupplierIDAO
supplier
Dao
)
{
this
.
supplierDao
=
supplier
Dao
;
}
public
void
batchSetEnable
(
Boolean
enable
,
String
supplierIDs
)
{
supplierDao
.
batchSetEnable
(
enable
,
supplierIDs
)
;
}
public
void
setUserBusinessDao
(
UserBusinessIDAO
userBusinessDao
)
{
this
.
userBusinessDao
=
userBusinessDao
;
}
/**
* 初始化加载所有系统基础数据
*/
@SuppressWarnings
({
"rawtypes"
})
private
static
Map
<
String
,
List
>
mapData
=
new
HashMap
<
String
,
List
>();
public
void
batchSetEnable
(
Boolean
enable
,
String
supplierIDs
)
{
supplierDao
.
batchSetEnable
(
enable
,
supplierIDs
);
}
/**
* 错误的表格数据
*/
private
static
List
<
Supplier
>
wrongData
=
new
ArrayList
<
Supplier
>();
/**
* 导出Excel表格
*/
@Override
public
InputStream
exmportExcel
(
String
isAllPage
,
PageUtil
<
Supplier
>
pageUtil
)
throws
JshException
{
try
{
//将OutputStream转化为InputStream
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
putDataOnOutputStream
(
out
,
pageUtil
.
getPageList
());
return
new
ByteArrayInputStream
(
out
.
toByteArray
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常"
,
e
);
throw
new
JshException
(
"导出信息为excel表格异常"
,
e
);
}
}
/**
* 导出Excel表格
*/
@Override
public
InputStream
exmportExcel
(
String
isAllPage
,
PageUtil
<
Supplier
>
pageUtil
)
throws
JshException
{
try
{
//将OutputStream转化为InputStream
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
putDataOnOutputStream
(
out
,
pageUtil
.
getPageList
());
return
new
ByteArrayInputStream
(
out
.
toByteArray
());
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常"
,
e
);
throw
new
JshException
(
"导出信息为excel表格异常"
,
e
);
}
}
/**
* 生成excel表格
* @param os
*/
@SuppressWarnings
(
"deprecation"
)
private
void
putDataOnOutputStream
(
OutputStream
os
,
List
<
Supplier
>
dataList
)
{
WritableWorkbook
workbook
=
null
;
try
{
workbook
=
Workbook
.
createWorkbook
(
os
);
WritableSheet
sheet
=
w
orkbook
.
create
Sheet
(
"信息报表"
,
0
);
//增加列头
String
[]
colunmName
=
{
"名称"
,
"类型"
,
"联系人"
,
"电话"
,
"电子邮箱"
,
"预收款"
,
"期初应收"
,
"期初应付"
,
"备注"
,
"传真"
,
"手机"
,
"地址"
,
"纳税人识别号"
,
"开户行"
,
"账号"
,
"税率"
,
"状态"
};
for
(
int
i
=
0
;
i
<
colunmName
.
length
;
i
++)
{
sheet
.
setColumnView
(
i
,
10
);
sheet
.
addCell
(
new
Label
(
i
,
0
,
colunmName
[
i
])
);
}
if
(
null
!=
dataList
&&
dataList
.
size
()
>
0
)
{
int
i
=
1
;
for
(
Supplier
supplier:
dataList
){
int
j
=
0
;
Map
<
Integer
,
String
>
cellInfo
=
supplier
.
getCellInfo
()
;
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Supplier
())
);
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Type
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Contacts
()
==
null
?
""
:
supplier
.
getContacts
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Phonenum
()
==
null
?
""
:
supplier
.
get
Phonenum
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Email
()
==
null
?
""
:
supplier
.
get
Email
()));
sheet
.
addCell
(
get
Label
Info
(
cellInfo
,
j
++,
i
,
supplier
.
get
AdvanceIn
()
==
null
?
""
:
supplier
.
get
AdvanceIn
().
toString
(),
supplier
));
sheet
.
addCell
(
getLabelInfo
(
cellInfo
,
j
++,
i
,
supplier
.
get
BeginNeedGet
()
==
null
?
""
:
supplier
.
get
BeginNeedGet
().
toString
(),
supplier
));
sheet
.
addCell
(
getLabelInfo
(
cellInfo
,
j
++,
i
,
supplier
.
getBeginNeed
Pay
()
==
null
?
""
:
supplier
.
getBeginNeed
Pay
().
toString
(),
supplier
));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Description
()
==
null
?
""
:
supplier
.
get
Description
()
));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Fax
()
==
null
?
""
:
supplier
.
get
Fax
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Telephone
()
==
null
?
""
:
supplier
.
get
Telephone
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Address
()
==
null
?
""
:
supplier
.
get
Address
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
TaxNum
()
==
null
?
""
:
supplier
.
get
TaxNum
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
BankName
()
==
null
?
""
:
supplier
.
get
BankName
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
AccountNumber
()
==
null
?
""
:
supplier
.
get
AccountNumber
()));
sheet
.
addCell
(
get
Label
Info
(
cellInfo
,
j
++,
i
,
supplier
.
get
TaxRate
()
==
null
?
""
:
supplier
.
get
TaxRate
().
toString
(),
supplier
));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Enabled
()?
"启用"
:
"禁用"
));
i
++
;
}
}
workbook
.
write
();
workbook
.
clos
e
();
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常"
,
e
);
}
}
/**
* 生成excel表格
*
* @param os
*/
@SuppressWarnings
(
"deprecation"
)
private
void
putDataOnOutputStream
(
OutputStream
os
,
List
<
Supplier
>
dataList
)
{
WritableWorkbook
workbook
=
null
;
try
{
workbook
=
W
orkbook
.
create
Workbook
(
os
);
WritableSheet
sheet
=
workbook
.
createSheet
(
"信息报表"
,
0
);
//增加列头
String
[]
colunmName
=
{
"名称"
,
"类型"
,
"联系人"
,
"电话"
,
"电子邮箱"
,
"预收款"
,
"期初应收"
,
"期初应付"
,
"备注"
,
"传真"
,
"手机"
,
"地址"
,
"纳税人识别号"
,
"开户行"
,
"账号"
,
"税率"
,
"状态"
};
for
(
int
i
=
0
;
i
<
colunmName
.
length
;
i
++)
{
sheet
.
setColumnView
(
i
,
10
);
sheet
.
addCell
(
new
Label
(
i
,
0
,
colunmName
[
i
]));
}
if
(
null
!=
dataList
&&
dataList
.
size
()
>
0
)
{
int
i
=
1
;
for
(
Supplier
supplier
:
dataList
)
{
int
j
=
0
;
Map
<
Integer
,
String
>
cellInfo
=
supplier
.
get
CellInfo
(
);
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Supplier
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Type
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Contacts
()
==
null
?
""
:
supplier
.
get
Contacts
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Phonenum
()
==
null
?
""
:
supplier
.
get
Phonenum
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Email
()
==
null
?
""
:
supplier
.
get
Email
()
));
sheet
.
addCell
(
getLabelInfo
(
cellInfo
,
j
++,
i
,
supplier
.
get
AdvanceIn
()
==
null
?
""
:
supplier
.
get
AdvanceIn
().
toString
(),
supplier
));
sheet
.
addCell
(
getLabelInfo
(
cellInfo
,
j
++,
i
,
supplier
.
getBeginNeed
Get
()
==
null
?
""
:
supplier
.
getBeginNeed
Get
().
toString
(),
supplier
));
sheet
.
addCell
(
get
Label
Info
(
cellInfo
,
j
++,
i
,
supplier
.
get
BeginNeedPay
()
==
null
?
""
:
supplier
.
get
BeginNeedPay
().
toString
(),
supplier
));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Description
()
==
null
?
""
:
supplier
.
get
Description
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Fax
()
==
null
?
""
:
supplier
.
get
Fax
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Telephone
()
==
null
?
""
:
supplier
.
get
Telephone
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
Address
()
==
null
?
""
:
supplier
.
get
Address
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
TaxNum
()
==
null
?
""
:
supplier
.
get
TaxNum
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
BankName
()
==
null
?
""
:
supplier
.
get
BankName
()));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
get
AccountNumber
()
==
null
?
""
:
supplier
.
get
AccountNumber
()
));
sheet
.
addCell
(
get
Label
Info
(
cellInfo
,
j
++,
i
,
supplier
.
get
TaxRate
()
==
null
?
""
:
supplier
.
getTaxRate
().
toString
(),
supplier
));
sheet
.
addCell
(
new
Label
(
j
++,
i
,
supplier
.
getEnabled
()
?
"启用"
:
"禁用"
))
;
i
++;
}
}
workbook
.
writ
e
();
workbook
.
close
();
}
catch
(
Exception
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常"
,
e
);
}
}
/**
* 根据错误信息进行提示--excel表格背景设置为红色,表示导入信息有误
* @param cellInfo
* @param cell
Num
* @param c
olumn
Num
* @param
value
* @return
*/
private
Label
getLabelInfo
(
Map
<
Integer
,
String
>
cellInfo
,
int
cellNum
,
int
columnNum
,
String
value
,
Supplier
supplier
)
{
Label
label
=
null
;
/**
* 根据错误信息进行提示--excel表格背景设置为红色,表示导入信息有误
*
* @param cell
Info
* @param c
ell
Num
* @param
columnNum
* @param value
* @return
*/
private
Label
getLabelInfo
(
Map
<
Integer
,
String
>
cellInfo
,
int
cellNum
,
int
columnNum
,
String
value
,
Supplier
supplier
)
{
Label
label
=
null
;
//设置背景颜色
WritableCellFormat
cellFormat
=
new
WritableCellFormat
();
try
{
cellFormat
.
setBackground
(
Colour
.
RED
);
}
catch
(
WriteException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误"
,
e
);
}
//设置背景颜色
WritableCellFormat
cellFormat
=
new
WritableCellFormat
();
try
{
cellFormat
.
setBackground
(
Colour
.
RED
);
}
catch
(
WriteException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误"
,
e
);
}
if
(
null
==
cellInfo
||
cellInfo
.
size
()
==
0
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
value
);
}
else
{
//表示此单元格有错误
if
(
cellInfo
.
containsKey
(
cellNum
))
{
if
(
cellNum
==
SupplierConstants
.
BusinessForExcel
.
EXCEL_ADVANCE_IN
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
supplier
.
getAdvanceInStr
(),
cellFormat
);
}
else
if
(
cellNum
==
SupplierConstants
.
BusinessForExcel
.
EXCEL_BEGIN_NEED_GET
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
supplier
.
getBeginNeedGetStr
(),
cellFormat
);
}
else
if
(
cellNum
==
SupplierConstants
.
BusinessForExcel
.
EXCEL_BEGIN_NEED_PAY
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
supplier
.
getBeginNeedPayStr
(),
cellFormat
);
}
else
if
(
cellNum
==
SupplierConstants
.
BusinessForExcel
.
EXCEL_TAX_RATE
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
supplier
.
getTaxRateStr
(),
cellFormat
);
}
}
else
{
label
=
new
Label
(
cellNum
,
columnNum
,
value
);
}
}
return
label
;
}
if
(
null
==
cellInfo
||
cellInfo
.
size
()
==
0
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
value
);
}
else
{
//表示此单元格有错误
if
(
cellInfo
.
containsKey
(
cellNum
))
{
if
(
cellNum
==
SupplierConstants
.
BusinessForExcel
.
EXCEL_ADVANCE_IN
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
supplier
.
getAdvanceInStr
(),
cellFormat
);
}
else
if
(
cellNum
==
SupplierConstants
.
BusinessForExcel
.
EXCEL_BEGIN_NEED_GET
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
supplier
.
getBeginNeedGetStr
(),
cellFormat
);
}
else
if
(
cellNum
==
SupplierConstants
.
BusinessForExcel
.
EXCEL_BEGIN_NEED_PAY
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
supplier
.
getBeginNeedPayStr
(),
cellFormat
);
}
else
if
(
cellNum
==
SupplierConstants
.
BusinessForExcel
.
EXCEL_TAX_RATE
)
{
label
=
new
Label
(
cellNum
,
columnNum
,
supplier
.
getTaxRateStr
(),
cellFormat
);
}
}
else
{
label
=
new
Label
(
cellNum
,
columnNum
,
value
);
}
}
return
label
;
}
@Override
public
InputStream
importExcel
(
File
assetFile
)
throws
JshException
{
//全局变量--每次调用前需要清空数据
mapData
.
clear
();
//2、解析文件成资产数据
parseFile
(
assetFile
);
@Override
public
InputStream
importExcel
(
File
assetFile
)
throws
JshException
{
//全局变量--每次调用前需要清空数据
mapData
.
clear
();
//2、解析文件成资产数据
parseFile
(
assetFile
);
if
(
null
!=
wrongData
&&
wrongData
.
size
()>
0
)
{
//将OutputStream转化为InputStream
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
putDataOnOutputStream
(
out
,
wrongData
);
return
new
ByteArrayInputStream
(
out
.
toByteArray
());
}
else
{
return
null
;
}
}
if
(
null
!=
wrongData
&&
wrongData
.
size
()
>
0
)
{
//将OutputStream转化为InputStream
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
putDataOnOutputStream
(
out
,
wrongData
);
return
new
ByteArrayInputStream
(
out
.
toByteArray
());
}
else
{
return
null
;
}
}
/**
* 解析excel表格
* @param assetFile
*/
@SuppressWarnings
(
"unchecked"
)
private
void
parseFile
(
File
assetFile
)
{
//每次调用前清空
wrongData
.
clear
();
int
totalRow
=
0
;
try
{
//创建对Excel工作簿文件的引用
HSSFWorkbook
workbook
=
new
HSSFWorkbook
(
new
FileInputStream
(
assetFile
));
//创建对工作表的引用,获取第一个工作表的内容
HSSFSheet
sheet
=
workbook
.
getSheetAt
(
0
);
/**
* =====================================
* 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列
* 2、文件内容为空处理
* 3、如果是修改过的文件内容
*/
Iterator
<
Row
>
itsheet
=
sheet
.
rowIterator
();
while
(
itsheet
.
hasNext
())
{
//获取当前行数据
Row
row
=
itsheet
.
next
();
//获取一行有多少单元格
/**
* 解析excel表格
*
* @param assetFile
*/
@SuppressWarnings
(
"unchecked"
)
private
void
parseFile
(
File
assetFile
)
{
//每次调用前清空
wrongData
.
clear
();
int
totalRow
=
0
;
try
{
//创建对Excel工作簿文件的引用
HSSFWorkbook
workbook
=
new
HSSFWorkbook
(
new
FileInputStream
(
assetFile
));
//创建对工作表的引用,获取第一个工作表的内容
HSSFSheet
sheet
=
workbook
.
getSheetAt
(
0
);
/**
* =====================================
* 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列
* 2、文件内容为空处理
* 3、如果是修改过的文件内容
*/
Iterator
<
Row
>
itsheet
=
sheet
.
rowIterator
();
while
(
itsheet
.
hasNext
())
{
//获取当前行数据
Row
row
=
itsheet
.
next
();
//获取一行有多少单元格
// System.out.println(row.getLastCellNum());
//excel表格第几行数据 从1开始 0 是表头
int
rowNum
=
row
.
getRowNum
();
/**
* 表头跳过不读
*/
if
(
SupplierConstants
.
BusinessForExcel
.
EXCEL_TABLE_HEAD
==
rowNum
)
continue
;
//excel表格第几行数据 从1开始 0 是表头
int
rowNum
=
row
.
getRowNum
();
/**
* 表头跳过不读
*/
if
(
SupplierConstants
.
BusinessForExcel
.
EXCEL_TABLE_HEAD
==
rowNum
)
continue
;
//开始处理excel表格内容 --每行数据读取,同时统计总共行数
totalRow
++;
//开始处理excel表格内容 --每行数据读取,同时统计总共行数
totalRow
++;
//获取excel表格的每格数据内容
Iterator
<
Cell
>
it
=
row
.
cellIterator
();
//资产子类型--添加了一些excel表格数据
Supplier
supplier
=
new
Supplier
();
//保存每个单元格错误类型
Map
<
Integer
,
String
>
cellType
=
new
HashMap
<
Integer
,
String
>();
Boolean
hasBeginNeedGet
=
false
;
//是否存在期初应付
//设置列号
supplier
.
setRowLineNum
(
rowNum
);
//获取excel表格的每格数据内容
Iterator
<
Cell
>
it
=
row
.
cellIterator
();
//资产子类型--添加了一些excel表格数据
Supplier
supplier
=
new
Supplier
();
//保存每个单元格错误类型
Map
<
Integer
,
String
>
cellType
=
new
HashMap
<
Integer
,
String
>();
Boolean
hasBeginNeedGet
=
false
;
//是否存在期初应付
//设置列号
supplier
.
setRowLineNum
(
rowNum
);
Cell
cell
=
null
;
//判断列号--从零开始
int
cellIndex
=
0
;
while
(
it
.
hasNext
())
{
//获取每个单元格对象
cell
=
it
.
next
();
//获取列号
cellIndex
=
cell
.
getColumnIndex
();
//设置此单元格为字符串类型
cell
.
setCellType
(
Cell
.
CELL_TYPE_STRING
);
Cell
cell
=
null
;
//判断列号--从零开始
int
cellIndex
=
0
;
while
(
it
.
hasNext
())
{
//获取每个单元格对象
cell
=
it
.
next
();
//获取列号
cellIndex
=
cell
.
getColumnIndex
();
//设置此单元格为字符串类型
cell
.
setCellType
(
Cell
.
CELL_TYPE_STRING
);
Log
.
infoFileSync
(
"==================excel表格中第"
+
totalRow
+
"行的第 "
+
cellIndex
+
"列的值为"
+
cell
.
getStringCellValue
());
Log
.
infoFileSync
(
"==================excel表格中第"
+
totalRow
+
"行的第 "
+
cellIndex
+
"列的值为"
+
cell
.
getStringCellValue
());
//每行中数据顺序 "名称","类型","联系人","电话","电子邮箱","预收款","期初应收","期初应付","备注","传真","手机","地址","纳税人识别号","开户行","账号","税率"
switch
(
cellIndex
)
{
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_SUPPLIER
:
String
supplierName
=
cell
.
getStringCellValue
();
if
(
null
==
supplierName
||
""
.
equals
(
supplierName
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(名称)信息"
);
break
;
}
supplier
.
setSupplier
(
supplierName
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_TYPE
:
String
type
=
cell
.
getStringCellValue
();
if
(
null
==
type
||
""
.
equals
(
type
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(类型)信息"
);
break
;
}
supplier
.
setType
(
type
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_CONTACTS
:
String
contacts
=
cell
.
getStringCellValue
();
if
(
null
==
contacts
||
""
.
equals
(
contacts
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(联系人)信息"
);
break
;
}
supplier
.
setContacts
(
contacts
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_PHONE_NUM
:
String
phoneNum
=
cell
.
getStringCellValue
();
if
(
null
==
phoneNum
||
""
.
equals
(
phoneNum
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(电话)信息"
);
break
;
}
supplier
.
setPhonenum
(
phoneNum
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_EMAIL
:
String
email
=
cell
.
getStringCellValue
();
if
(
null
==
email
||
""
.
equals
(
email
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(电子邮箱)信息"
);
break
;
}
supplier
.
setEmail
(
email
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_ADVANCE_IN
:
String
advanceIn
=
cell
.
getStringCellValue
();
if
(
null
==
advanceIn
||
""
.
equals
(
advanceIn
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(预收款)信息"
);
break
;
}
if
(
Tools
.
checkStrIsNum
(
advanceIn
))
{
supplier
.
setAdvanceIn
(
Double
.
parseDouble
(
advanceIn
));
}
else
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(预收款)不是数字格式"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setAdvanceIn
(
0.00d
);
supplier
.
setAdvanceInStr
(
advanceIn
);
}
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_BEGIN_NEED_GET
:
String
beginNeedGet
=
cell
.
getStringCellValue
();
if
(
null
==
beginNeedGet
||
""
.
equals
(
beginNeedGet
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(期初应收)信息"
);
break
;
}
if
(
Tools
.
checkStrIsNum
(
beginNeedGet
)
&&
Double
.
parseDouble
(
beginNeedGet
)>=
0
)
{
if
(
Double
.
parseDouble
(
beginNeedGet
)>
0
)
{
hasBeginNeedGet
=
true
;
//存在期初应付信息
}
supplier
.
setBeginNeedGet
(
Double
.
parseDouble
(
beginNeedGet
));
}
else
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(期初应收)不是数字格式"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setBeginNeedGet
(
0.00d
);
supplier
.
setBeginNeedGetStr
(
beginNeedGet
);
}
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_BEGIN_NEED_PAY
:
String
beginNeedPay
=
cell
.
getStringCellValue
();
if
(
null
==
beginNeedPay
||
""
.
equals
(
beginNeedPay
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(期初应付)信息"
);
break
;
}
if
(
Tools
.
checkStrIsNum
(
beginNeedPay
)
&&
Double
.
parseDouble
(
beginNeedPay
)>=
0
)
{
if
(
hasBeginNeedGet
){
//同时存在不允许
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(期初应付)和期初应收不能同时存在"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setBeginNeedPay
(
0.00d
);
supplier
.
setBeginNeedPayStr
(
beginNeedPay
);
}
else
{
supplier
.
setBeginNeedPay
(
Double
.
parseDouble
(
beginNeedPay
));
}
}
else
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(期初应付)不是数字格式"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setBeginNeedPay
(
0.00d
);
supplier
.
setBeginNeedPayStr
(
beginNeedPay
);
}
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_DESCRIPTION
:
String
description
=
cell
.
getStringCellValue
();
if
(
null
==
description
||
""
.
equals
(
description
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(备注)信息"
);
break
;
}
supplier
.
setDescription
(
description
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_FAX
:
String
fax
=
cell
.
getStringCellValue
();
if
(
null
==
fax
||
""
.
equals
(
fax
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(传真)信息"
);
break
;
}
supplier
.
setFax
(
fax
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_TELEPHONE
:
String
telephone
=
cell
.
getStringCellValue
();
if
(
null
==
telephone
||
""
.
equals
(
telephone
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(手机)信息"
);
break
;
}
supplier
.
setTelephone
(
telephone
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_ADDRESS
:
String
address
=
cell
.
getStringCellValue
();
if
(
null
==
address
||
""
.
equals
(
address
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(地址)信息"
);
break
;
}
supplier
.
setAddress
(
address
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_TAX_NUM
:
String
taxNum
=
cell
.
getStringCellValue
();
if
(
null
==
taxNum
||
""
.
equals
(
taxNum
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(纳税人识别号)信息"
);
break
;
}
supplier
.
setTaxNum
(
taxNum
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_BANK_NAME
:
String
bankName
=
cell
.
getStringCellValue
();
if
(
null
==
bankName
||
""
.
equals
(
bankName
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(开户行)信息"
);
break
;
}
supplier
.
setBankName
(
bankName
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_ACCOUNT_NUMBER
:
String
accountNumber
=
cell
.
getStringCellValue
();
if
(
null
==
accountNumber
||
""
.
equals
(
accountNumber
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(账号)信息"
);
break
;
}
supplier
.
setAccountNumber
(
accountNumber
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_TAX_RATE
:
String
taxRate
=
cell
.
getStringCellValue
();
if
(
null
==
taxRate
||
""
.
equals
(
taxRate
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(税率)信息"
);
break
;
}
if
(
Tools
.
checkStrIsNum
(
taxRate
))
{
supplier
.
setTaxRate
(
Double
.
parseDouble
(
taxRate
));
}
else
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(税率)不是数字格式"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setTaxRate
(
0.00d
);
supplier
.
setTaxRateStr
(
taxRate
);
}
break
;
}
}
supplier
.
setCellInfo
(
cellType
);
//每行中数据顺序 "名称","类型","联系人","电话","电子邮箱","预收款","期初应收","期初应付","备注","传真","手机","地址","纳税人识别号","开户行","账号","税率"
switch
(
cellIndex
)
{
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_SUPPLIER
:
String
supplierName
=
cell
.
getStringCellValue
();
if
(
null
==
supplierName
||
""
.
equals
(
supplierName
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(名称)信息"
);
break
;
}
supplier
.
setSupplier
(
supplierName
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_TYPE
:
String
type
=
cell
.
getStringCellValue
();
if
(
null
==
type
||
""
.
equals
(
type
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(类型)信息"
);
break
;
}
supplier
.
setType
(
type
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_CONTACTS
:
String
contacts
=
cell
.
getStringCellValue
();
if
(
null
==
contacts
||
""
.
equals
(
contacts
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(联系人)信息"
);
break
;
}
supplier
.
setContacts
(
contacts
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_PHONE_NUM
:
String
phoneNum
=
cell
.
getStringCellValue
();
if
(
null
==
phoneNum
||
""
.
equals
(
phoneNum
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(电话)信息"
);
break
;
}
supplier
.
setPhonenum
(
phoneNum
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_EMAIL
:
String
email
=
cell
.
getStringCellValue
();
if
(
null
==
email
||
""
.
equals
(
email
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(电子邮箱)信息"
);
break
;
}
supplier
.
setEmail
(
email
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_ADVANCE_IN
:
String
advanceIn
=
cell
.
getStringCellValue
();
if
(
null
==
advanceIn
||
""
.
equals
(
advanceIn
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(预收款)信息"
);
break
;
}
if
(
Tools
.
checkStrIsNum
(
advanceIn
))
{
supplier
.
setAdvanceIn
(
Double
.
parseDouble
(
advanceIn
));
}
else
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(预收款)不是数字格式"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setAdvanceIn
(
0.00d
);
supplier
.
setAdvanceInStr
(
advanceIn
);
}
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_BEGIN_NEED_GET
:
String
beginNeedGet
=
cell
.
getStringCellValue
();
if
(
null
==
beginNeedGet
||
""
.
equals
(
beginNeedGet
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(期初应收)信息"
);
break
;
}
if
(
Tools
.
checkStrIsNum
(
beginNeedGet
)
&&
Double
.
parseDouble
(
beginNeedGet
)
>=
0
)
{
if
(
Double
.
parseDouble
(
beginNeedGet
)
>
0
)
{
hasBeginNeedGet
=
true
;
//存在期初应付信息
}
supplier
.
setBeginNeedGet
(
Double
.
parseDouble
(
beginNeedGet
));
}
else
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(期初应收)不是数字格式"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setBeginNeedGet
(
0.00d
);
supplier
.
setBeginNeedGetStr
(
beginNeedGet
);
}
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_BEGIN_NEED_PAY
:
String
beginNeedPay
=
cell
.
getStringCellValue
();
if
(
null
==
beginNeedPay
||
""
.
equals
(
beginNeedPay
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(期初应付)信息"
);
break
;
}
if
(
Tools
.
checkStrIsNum
(
beginNeedPay
)
&&
Double
.
parseDouble
(
beginNeedPay
)
>=
0
)
{
if
(
hasBeginNeedGet
)
{
//同时存在不允许
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(期初应付)和期初应收不能同时存在"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setBeginNeedPay
(
0.00d
);
supplier
.
setBeginNeedPayStr
(
beginNeedPay
);
}
else
{
supplier
.
setBeginNeedPay
(
Double
.
parseDouble
(
beginNeedPay
));
}
}
else
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(期初应付)不是数字格式"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setBeginNeedPay
(
0.00d
);
supplier
.
setBeginNeedPayStr
(
beginNeedPay
);
}
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_DESCRIPTION
:
String
description
=
cell
.
getStringCellValue
();
if
(
null
==
description
||
""
.
equals
(
description
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(备注)信息"
);
break
;
}
supplier
.
setDescription
(
description
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_FAX
:
String
fax
=
cell
.
getStringCellValue
();
if
(
null
==
fax
||
""
.
equals
(
fax
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(传真)信息"
);
break
;
}
supplier
.
setFax
(
fax
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_TELEPHONE
:
String
telephone
=
cell
.
getStringCellValue
();
if
(
null
==
telephone
||
""
.
equals
(
telephone
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(手机)信息"
);
break
;
}
supplier
.
setTelephone
(
telephone
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_ADDRESS
:
String
address
=
cell
.
getStringCellValue
();
if
(
null
==
address
||
""
.
equals
(
address
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(地址)信息"
);
break
;
}
supplier
.
setAddress
(
address
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_TAX_NUM
:
String
taxNum
=
cell
.
getStringCellValue
();
if
(
null
==
taxNum
||
""
.
equals
(
taxNum
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(纳税人识别号)信息"
);
break
;
}
supplier
.
setTaxNum
(
taxNum
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_BANK_NAME
:
String
bankName
=
cell
.
getStringCellValue
();
if
(
null
==
bankName
||
""
.
equals
(
bankName
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(开户行)信息"
);
break
;
}
supplier
.
setBankName
(
bankName
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_ACCOUNT_NUMBER
:
String
accountNumber
=
cell
.
getStringCellValue
();
if
(
null
==
accountNumber
||
""
.
equals
(
accountNumber
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(账号)信息"
);
break
;
}
supplier
.
setAccountNumber
(
accountNumber
);
break
;
case
SupplierConstants
.
BusinessForExcel
.
EXCEL_TAX_RATE
:
String
taxRate
=
cell
.
getStringCellValue
();
if
(
null
==
taxRate
||
""
.
equals
(
taxRate
))
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>列表没有填写(税率)信息"
);
break
;
}
if
(
Tools
.
checkStrIsNum
(
taxRate
))
{
supplier
.
setTaxRate
(
Double
.
parseDouble
(
taxRate
));
}
else
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>(税率)不是数字格式"
);
cellType
.
put
(
cellIndex
,
"wrong"
);
supplier
.
setTaxRate
(
0.00d
);
supplier
.
setTaxRateStr
(
taxRate
);
}
break
;
}
}
supplier
.
setCellInfo
(
cellType
);
Log
.
infoFileSync
(
totalRow
+
"行总共有"
+
cellIndex
+
"列"
);
Log
.
infoFileSync
(
totalRow
+
"行总共有"
+
cellIndex
+
"列"
);
//判断完成后增加数据
if
((
null
!=
cellType
&&
cellType
.
size
()
>
0
)
||
supplier
.
getSupplier
()
==
null
)
{
wrongData
.
add
(
supplier
);
}
else
{
supplier
.
setEnabled
(
true
);
supplier
.
setIsystem
((
short
)
1
);
supplierDao
.
save
(
supplier
);
}
}
}
catch
(
FileNotFoundException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!"
,
e
);
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !"
,
e
);
}
Log
.
infoFileSync
(
"===================excel表格总共有 "
+
totalRow
+
" 条记录!"
);
}
//判断完成后增加数据
if
((
null
!=
cellType
&&
cellType
.
size
()
>
0
)
||
supplier
.
getSupplier
()
==
null
)
{
wrongData
.
add
(
supplier
);
}
else
{
supplier
.
setEnabled
(
true
);
supplier
.
setIsystem
((
short
)
1
);
supplierDao
.
save
(
supplier
);
}
}
}
catch
(
FileNotFoundException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!"
,
e
);
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !"
,
e
);
}
Log
.
infoFileSync
(
"===================excel表格总共有 "
+
totalRow
+
" 条记录!"
);
}
}
src/main/java/com/jsh/service/basic/SystemConfigIService.java
View file @
07259995
...
...
@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.SystemConfig
;
public
interface
SystemConfigIService
extends
BaseIService
<
SystemConfig
>
{
public
interface
SystemConfigIService
extends
BaseIService
<
SystemConfig
>
{
}
src/main/java/com/jsh/service/basic/SystemConfigService.java
View file @
07259995
...
...
@@ -4,20 +4,17 @@ import com.jsh.base.BaseService;
import
com.jsh.dao.basic.SystemConfigIDAO
;
import
com.jsh.model.po.SystemConfig
;
public
class
SystemConfigService
extends
BaseService
<
SystemConfig
>
implements
SystemConfigIService
{
@SuppressWarnings
(
"unused"
)
private
SystemConfigIDAO
systemConfigDao
;
public
class
SystemConfigService
extends
BaseService
<
SystemConfig
>
implements
SystemConfigIService
{
@SuppressWarnings
(
"unused"
)
private
SystemConfigIDAO
systemConfigDao
;
public
void
setSystemConfigDao
(
SystemConfigIDAO
systemConfigDao
)
{
this
.
systemConfigDao
=
systemConfigDao
;
}
public
void
setSystemConfigDao
(
SystemConfigIDAO
systemConfigDao
)
{
this
.
systemConfigDao
=
systemConfigDao
;
}
@Override
protected
Class
<
SystemConfig
>
getEntityClass
()
{
return
SystemConfig
.
class
;
}
@Override
protected
Class
<
SystemConfig
>
getEntityClass
()
{
return
SystemConfig
.
class
;
}
}
src/main/java/com/jsh/service/basic/UnitIService.java
View file @
07259995
...
...
@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import
com.jsh.base.BaseIService
;
import
com.jsh.model.po.Unit
;
public
interface
UnitIService
extends
BaseIService
<
Unit
>
{
public
interface
UnitIService
extends
BaseIService
<
Unit
>
{
}
src/main/java/com/jsh/service/basic/UnitService.java
View file @
07259995
...
...
@@ -4,21 +4,18 @@ import com.jsh.base.BaseService;
import
com.jsh.dao.basic.UnitIDAO
;
import
com.jsh.model.po.Unit
;
public
class
UnitService
extends
BaseService
<
Unit
>
implements
UnitIService
{
@SuppressWarnings
(
"unused"
)
private
UnitIDAO
unitDao
;
public
class
UnitService
extends
BaseService
<
Unit
>
implements
UnitIService
{
@SuppressWarnings
(
"unused"
)
private
UnitIDAO
unitDao
;
public
void
setUnitDao
(
UnitIDAO
unitDao
)
{
this
.
unitDao
=
unitDao
;
}
public
void
setUnitDao
(
UnitIDAO
unitDao
)
{
this
.
unitDao
=
unitDao
;
}
@Override
protected
Class
<
Unit
>
getEntityClass
()
{
return
Unit
.
class
;
}
@Override
protected
Class
<
Unit
>
getEntityClass
()
{
return
Unit
.
class
;
}
}
src/main/java/com/jsh/service/basic/UserBusinessIService.java
View file @
07259995
package
com.jsh.service.basic
;
import
com.jsh.base.BaseIService
;
import
com.jsh.util.JshException
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.util.JshException
;
import
com.jsh.util.PageUtil
;
public
interface
UserBusinessIService
extends
BaseIService
<
UserBusiness
>
{
/*
* 测试一下自定义hql语句
*/
void
find
(
PageUtil
<
UserBusiness
>
userBusiness
,
String
ceshi
)
throws
JshException
;
public
interface
UserBusinessIService
extends
BaseIService
<
UserBusiness
>
{
/*
* 测试一下自定义hql语句
*/
void
find
(
PageUtil
<
UserBusiness
>
userBusiness
,
String
ceshi
)
throws
JshException
;
}
src/main/java/com/jsh/service/basic/UserBusinessService.java
View file @
07259995
...
...
@@ -2,31 +2,27 @@ package com.jsh.service.basic;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.basic.UserBusinessIDAO
;
import
com.jsh.util.JshException
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.util.JshException
;
import
com.jsh.util.PageUtil
;
public
class
UserBusinessService
extends
BaseService
<
UserBusiness
>
implements
UserBusinessIService
{
@SuppressWarnings
(
"unused"
)
private
UserBusinessIDAO
userBusinessDao
;
public
class
UserBusinessService
extends
BaseService
<
UserBusiness
>
implements
UserBusinessIService
{
@SuppressWarnings
(
"unused"
)
private
UserBusinessIDAO
userBusinessDao
;
public
void
setUserBusinessDao
(
UserBusinessIDAO
userBusinessDao
)
{
this
.
userBusinessDao
=
userBusinessDao
;
}
public
void
setUserBusinessDao
(
UserBusinessIDAO
userBusinessDao
)
{
this
.
userBusinessDao
=
userBusinessDao
;
}
@Override
protected
Class
<
UserBusiness
>
getEntityClass
()
{
return
UserBusiness
.
class
;
}
@Override
protected
Class
<
UserBusiness
>
getEntityClass
()
{
return
UserBusiness
.
class
;
}
@Override
public
void
find
(
PageUtil
<
UserBusiness
>
pageUtil
,
String
ceshi
)
throws
JshException
{
userBusinessDao
.
find
(
pageUtil
,
ceshi
);
public
void
find
(
PageUtil
<
UserBusiness
>
pageUtil
,
String
ceshi
)
throws
JshException
{
userBusinessDao
.
find
(
pageUtil
,
ceshi
);
}
}
src/main/java/com/jsh/service/basic/UserIService.java
View file @
07259995
package
com.jsh.service.basic
;
import
com.jsh.base.BaseIService
;
import
com.jsh.util.JshException
;
import
com.jsh.model.po.Basicuser
;
import
com.jsh.util.JshException
;
public
interface
UserIService
extends
BaseIService
<
Basicuser
>
{
/**
* 判断用户名是否符合登录条件
*
* @param username 用户名 String password
* @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常
*/
int
validateUser
(
String
username
,
String
password
)
throws
JshException
;
public
interface
UserIService
extends
BaseIService
<
Basicuser
>
{
/*
*
* 判断用户名是否符合登录条件
* @param username 用户名 String password
* @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常
*/
int
validate
User
(
String
username
,
String
password
)
throws
JshException
;
/**
* 获取用户信息
*
* @param username
* @return 用户信息
* @throws JshException
*/
public
Basicuser
get
User
(
String
username
)
throws
JshException
;
/**
* 获取用户信息
* @param username
* @return 用户信息
* @throws JshException
*/
public
Basicuser
getUser
(
String
username
)
throws
JshException
;
/**
* 检查用户名称是否存在
* @param field 用户属性
* @param username 用户名称
* @param userID 供应商ID
* @return true==存在重名 false==不存在
* @throws JshException
*/
Boolean
checkIsNameExist
(
String
field
,
String
username
,
Long
userID
)
throws
JshException
;
/**
* 检查用户名称是否存在
*
* @param field 用户属性
* @param username 用户名称
* @param userID 供应商ID
* @return true==存在重名 false==不存在
* @throws JshException
*/
Boolean
checkIsNameExist
(
String
field
,
String
username
,
Long
userID
)
throws
JshException
;
}
src/main/java/com/jsh/service/basic/UserService.java
View file @
07259995
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.util.ExceptionCodeConstants
;
import
com.jsh.dao.basic.UserBusinessIDAO
;
import
com.jsh.dao.basic.UserIDAO
;
import
com.jsh.util.JshException
;
import
com.jsh.model.po.Basicuser
;
import
com.jsh.util.ExceptionCodeConstants
;
import
com.jsh.util.JshException
;
import
com.jsh.util.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
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
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
JshException
{
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
;
}
@Override
public
int
validateUser
(
String
username
,
String
password
)
throws
JshException
{
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
JshException
(
"unknown exception"
,
e
);
}
}
if
(
null
!=
list
&&
list
.
size
()
==
0
)
return
ExceptionCodeConstants
.
UserExceptionCode
.
USER_NOT_EXIST
;
@Override
public
Basicuser
getUser
(
String
username
)
throws
JshException
{
//全局变量 每次使用前清除
condition
.
clear
();
condition
.
put
(
"loginame_s_eq"
,
username
);
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
JshException
(
"unknown exception"
,
e
);
}
}
@Override
public
Basicuser
getUser
(
String
username
)
throws
JshException
{
//全局变量 每次使用前清除
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
JshException
(
"no username exist"
);
}
@Override
public
Boolean
checkIsNameExist
(
String
field
,
String
username
,
Long
userID
)
throws
JshException
{
condition
.
clear
();
if
(
null
!=
list
&&
list
.
size
()
>
0
)
return
list
.
get
(
0
);
else
throw
new
JshException
(
"no username exist"
);
}
@Override
public
Boolean
checkIsNameExist
(
String
field
,
String
username
,
Long
userID
)
throws
JshException
{
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
)
if
(
null
!=
dataList
&&
dataList
.
size
()
>
0
)
return
true
;
return
false
;
}
//==============spring注入等公共方法,与业务无关=========================
public
void
setUserDao
(
UserIDAO
userDao
)
{
this
.
userDao
=
userDao
;
}
}
//==============spring注入等公共方法,与业务无关=========================
public
void
setUserDao
(
UserIDAO
userDao
)
{
this
.
userDao
=
userDao
;
}
@Override
protected
Class
<
Basicuser
>
getEntityClass
()
{
return
Basicuser
.
class
;
}
@Override
protected
Class
<
Basicuser
>
getEntityClass
()
{
return
Basicuser
.
class
;
}
}
src/main/java/com/jsh/service/materials/AccountHeadIService.java
View file @
07259995
package
com.jsh.service.materials
;
import
com.jsh.base.BaseIService
;
import
com.jsh.util.JshException
;
import
com.jsh.model.po.AccountHead
;
import
com.jsh.model.po.DepotHead
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.util.JshException
;
import
com.jsh.util.PageUtil
;
public
interface
AccountHeadIService
extends
BaseIService
<
AccountHead
>
{
public
interface
AccountHeadIService
extends
BaseIService
<
AccountHead
>
{
/*
* 获取MaxId
*/
void
find
(
PageUtil
<
AccountHead
>
accountHead
,
String
maxid
)
throws
JshException
;
void
findAllMoney
(
PageUtil
<
AccountHead
>
accountHead
,
Integer
supplierId
,
String
type
,
String
mode
)
throws
JshException
;
void
find
(
PageUtil
<
AccountHead
>
accountHead
,
String
maxid
)
throws
JshException
;
void
findAllMoney
(
PageUtil
<
AccountHead
>
accountHead
,
Integer
supplierId
,
String
type
,
String
mode
)
throws
JshException
;
}
src/main/java/com/jsh/service/materials/AccountHeadService.java
View file @
07259995
...
...
@@ -2,14 +2,11 @@ package com.jsh.service.materials;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.materials.AccountHeadIDAO
;
import
com.jsh.util.JshException
;
import
com.jsh.model.po.AccountHead
;
import
com.jsh.model.po.DepotHead
;
import
com.jsh.model.po.UserBusiness
;
import
com.jsh.util.JshException
;
import
com.jsh.util.PageUtil
;
public
class
AccountHeadService
extends
BaseService
<
AccountHead
>
implements
AccountHeadIService
{
public
class
AccountHeadService
extends
BaseService
<
AccountHead
>
implements
AccountHeadIService
{
@SuppressWarnings
(
"unused"
)
private
AccountHeadIDAO
accountHeadDao
;
...
...
@@ -20,18 +17,15 @@ public class AccountHeadService extends BaseService<AccountHead> implements Acco
@Override
protected
Class
<
AccountHead
>
getEntityClass
()
{
protected
Class
<
AccountHead
>
getEntityClass
()
{
return
AccountHead
.
class
;
}
public
void
find
(
PageUtil
<
AccountHead
>
pageUtil
,
String
maxid
)
throws
JshException
{
public
void
find
(
PageUtil
<
AccountHead
>
pageUtil
,
String
maxid
)
throws
JshException
{
accountHeadDao
.
find
(
pageUtil
,
maxid
);
}
public
void
findAllMoney
(
PageUtil
<
AccountHead
>
pageUtil
,
Integer
supplierId
,
String
type
,
String
mode
)
throws
JshException
{
accountHeadDao
.
findAllMoney
(
pageUtil
,
supplierId
,
type
,
mode
);
public
void
findAllMoney
(
PageUtil
<
AccountHead
>
pageUtil
,
Integer
supplierId
,
String
type
,
String
mode
)
throws
JshException
{
accountHeadDao
.
findAllMoney
(
pageUtil
,
supplierId
,
type
,
mode
);
}
}
src/main/java/com/jsh/service/materials/AccountItemIService.java
View file @
07259995
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.util.JshException
;
import
com.jsh.model.po.Asset
;
import
com.jsh.model.po.AccountHead
;
import
com.jsh.model.po.AccountItem
;
import
com.jsh.util.PageUtil
;
public
interface
AccountItemIService
extends
BaseIService
<
AccountItem
>
{
public
interface
AccountItemIService
extends
BaseIService
<
AccountItem
>
{
}
Prev
1
…
5
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