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
ff9a0de5
Commit
ff9a0de5
authored
Apr 18, 2019
by
qiankunpingtai
Browse files
异常封装之商品信息后台修改
parent
fd7df687
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
ff9a0de5
...
...
@@ -46,7 +46,7 @@ public class MaterialController {
@RequestParam
(
"standard"
)
String
standard
,
@RequestParam
(
"mfrs"
)
String
mfrs
,
@RequestParam
(
"otherField1"
)
String
otherField1
,
@RequestParam
(
"otherField2"
)
String
otherField2
,
@RequestParam
(
"otherField3"
)
String
otherField3
,
@RequestParam
(
"unit"
)
String
unit
,
@RequestParam
(
"unitId"
)
Long
unitId
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
throws
Exception
{
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
int
exist
=
materialService
.
checkIsExist
(
id
,
name
,
model
,
color
,
standard
,
mfrs
,
otherField1
,
otherField2
,
otherField3
,
unit
,
unitId
);
...
...
@@ -85,7 +85,7 @@ public class MaterialController {
* @return
*/
@GetMapping
(
value
=
"/findById"
)
public
BaseResponseInfo
findById
(
@RequestParam
(
"id"
)
Long
id
,
HttpServletRequest
request
)
{
public
BaseResponseInfo
findById
(
@RequestParam
(
"id"
)
Long
id
,
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
List
<
MaterialVo4Unit
>
list
=
materialService
.
findById
(
id
);
...
...
@@ -106,7 +106,7 @@ public class MaterialController {
* @return
*/
@GetMapping
(
value
=
"/findBySelect"
)
public
JSONArray
findBySelect
(
@RequestParam
(
"mpList"
)
String
mpList
,
HttpServletRequest
request
)
{
public
JSONArray
findBySelect
(
@RequestParam
(
"mpList"
)
String
mpList
,
HttpServletRequest
request
)
throws
Exception
{
JSONArray
dataArray
=
new
JSONArray
();
try
{
List
<
MaterialVo4Unit
>
dataList
=
materialService
.
findBySelect
();
...
...
@@ -163,7 +163,7 @@ public class MaterialController {
* @return
*/
@GetMapping
(
value
=
"/findByOrder"
)
public
BaseResponseInfo
findByOrder
(
HttpServletRequest
request
)
{
public
BaseResponseInfo
findByOrder
(
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
try
{
...
...
@@ -203,7 +203,7 @@ public class MaterialController {
@RequestParam
(
"model"
)
String
model
,
@RequestParam
(
"categoryId"
)
Long
categoryId
,
@RequestParam
(
"categoryIds"
)
String
categoryIds
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
String
message
=
"成功"
;
...
...
@@ -303,7 +303,7 @@ public class MaterialController {
response
.
sendRedirect
(
"../pages/materials/material.html"
);
}
public
BigDecimal
parseBigDecimalEx
(
String
str
){
public
BigDecimal
parseBigDecimalEx
(
String
str
)
throws
Exception
{
if
(!
StringUtil
.
isEmpty
(
str
))
{
return
new
BigDecimal
(
str
);
}
else
{
...
...
@@ -313,7 +313,7 @@ public class MaterialController {
@RequestMapping
(
value
=
"/getMaterialEnableSerialNumberList"
)
public
String
getMaterialEnableSerialNumberList
(
@RequestParam
(
value
=
Constants
.
PAGE_SIZE
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
value
=
Constants
.
CURRENT_PAGE
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
Constants
.
SEARCH
,
required
=
false
)
String
search
)
{
@RequestParam
(
value
=
Constants
.
SEARCH
,
required
=
false
)
String
search
)
throws
Exception
{
Map
<
String
,
Object
>
parameterMap
=
new
HashMap
<
String
,
Object
>();
//查询参数
JSONObject
obj
=
JSON
.
parseObject
(
search
);
...
...
src/main/java/com/jsh/erp/service/material/MaterialComponent.java
View file @
ff9a0de5
...
...
@@ -21,16 +21,16 @@ public class MaterialComponent implements ICommonQuery {
private
MaterialService
materialService
;
@Override
public
Object
selectOne
(
String
condition
)
{
public
Object
selectOne
(
String
condition
)
throws
Exception
{
return
null
;
}
@Override
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
{
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
throws
Exception
{
return
getMaterialList
(
map
);
}
private
List
<?>
getMaterialList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getMaterialList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
model
=
StringUtil
.
getInfo
(
search
,
"model"
);
...
...
@@ -42,7 +42,7 @@ public class MaterialComponent implements ICommonQuery {
}
@Override
public
Long
counts
(
Map
<
String
,
String
>
map
)
{
public
Long
counts
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
model
=
StringUtil
.
getInfo
(
search
,
"model"
);
...
...
@@ -53,27 +53,27 @@ public class MaterialComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
materialService
.
insertMaterial
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
materialService
.
updateMaterial
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
materialService
.
deleteMaterial
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
materialService
.
batchDeleteMaterial
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
materialService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
ff9a0de5
...
...
@@ -39,20 +39,47 @@ public class MaterialService {
@Resource
private
DepotItemMapperEx
depotItemMapperEx
;
public
Material
getMaterial
(
long
id
)
{
return
materialMapper
.
selectByPrimaryKey
(
id
);
public
Material
getMaterial
(
long
id
)
throws
Exception
{
Material
result
=
null
;
try
{
result
=
materialMapper
.
selectByPrimaryKey
(
id
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
result
;
}
public
List
<
Material
>
getMaterial
()
{
public
List
<
Material
>
getMaterial
()
throws
Exception
{
MaterialExample
example
=
new
MaterialExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
return
materialMapper
.
selectByExample
(
example
);
List
<
Material
>
list
=
null
;
try
{
list
=
materialMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
MaterialVo4Unit
>
select
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
,
int
offset
,
int
rows
)
{
public
List
<
MaterialVo4Unit
>
select
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
,
int
offset
,
int
rows
)
throws
Exception
{
String
[]
mpArr
=
mpList
.
split
(
","
);
List
<
MaterialVo4Unit
>
resList
=
new
ArrayList
<
MaterialVo4Unit
>();
List
<
MaterialVo4Unit
>
list
=
materialMapperEx
.
selectByConditionMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
,
offset
,
rows
);
List
<
MaterialVo4Unit
>
list
=
null
;
try
{
list
=
materialMapperEx
.
selectByConditionMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
,
offset
,
rows
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
if
(
null
!=
list
)
{
for
(
MaterialVo4Unit
m
:
list
)
{
//扩展信息
...
...
@@ -84,53 +111,106 @@ public class MaterialService {
return
resList
;
}
public
Long
countMaterial
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
)
{
return
materialMapperEx
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
public
Long
countMaterial
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
)
throws
Exception
{
Long
result
=
null
;
try
{
result
=
materialMapperEx
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertMaterial
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertMaterial
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
Material
material
=
JSONObject
.
parseObject
(
beanJson
,
Material
.
class
);
material
.
setEnabled
(
true
);
return
materialMapper
.
insertSelective
(
material
);
int
result
=
0
;
try
{
result
=
materialMapper
.
insertSelective
(
material
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateMaterial
(
String
beanJson
,
Long
id
)
{
public
int
updateMaterial
(
String
beanJson
,
Long
id
)
throws
Exception
{
Material
material
=
JSONObject
.
parseObject
(
beanJson
,
Material
.
class
);
material
.
setId
(
id
);
int
res
=
materialMapper
.
updateByPrimaryKeySelective
(
material
);
Long
unitId
=
material
.
getUnitid
();
if
(
unitId
!=
null
)
{
materialMapperEx
.
updatePriceNullByPrimaryKey
(
id
);
//将价格置空
}
else
{
materialMapperEx
.
updateUnitIdNullByPrimaryKey
(
id
);
//将多单位置空
int
res
=
0
;
try
{
res
=
materialMapper
.
updateByPrimaryKeySelective
(
material
);
Long
unitId
=
material
.
getUnitid
();
if
(
unitId
!=
null
)
{
materialMapperEx
.
updatePriceNullByPrimaryKey
(
id
);
//将价格置空
}
else
{
materialMapperEx
.
updateUnitIdNullByPrimaryKey
(
id
);
//将多单位置空
}
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
res
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteMaterial
(
Long
id
)
{
return
materialMapper
.
deleteByPrimaryKey
(
id
);
public
int
deleteMaterial
(
Long
id
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
materialMapper
.
deleteByPrimaryKey
(
id
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterial
(
String
ids
)
{
public
int
batchDeleteMaterial
(
String
ids
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
MaterialExample
example
=
new
MaterialExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
return
materialMapper
.
deleteByExample
(
example
);
int
result
=
0
;
try
{
result
=
materialMapper
.
deleteByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
MaterialExample
example
=
new
MaterialExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Material
>
list
=
materialMapper
.
selectByExample
(
example
);
return
list
.
size
();
List
<
Material
>
list
=
null
;
try
{
list
=
materialMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
==
null
?
0
:
list
.
size
();
}
public
int
checkIsExist
(
Long
id
,
String
name
,
String
model
,
String
color
,
String
standard
,
String
mfrs
,
String
otherField1
,
String
otherField2
,
String
otherField3
,
String
unit
,
Long
unitId
)
{
String
otherField1
,
String
otherField2
,
String
otherField3
,
String
unit
,
Long
unitId
)
throws
Exception
{
MaterialExample
example
=
new
MaterialExample
();
MaterialExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andNameEqualTo
(
name
).
andModelEqualTo
(
model
).
andColorEqualTo
(
color
)
...
...
@@ -145,8 +225,16 @@ public class MaterialService {
if
(
unitId
!=
null
)
{
criteria
.
andUnitidEqualTo
(
unitId
);
}
List
<
Material
>
list
=
materialMapper
.
selectByExample
(
example
);
return
list
.
size
();
List
<
Material
>
list
=
null
;
try
{
list
=
materialMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
==
null
?
0
:
list
.
size
();
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
...
...
@@ -159,31 +247,84 @@ public class MaterialService {
material
.
setEnabled
(
enabled
);
MaterialExample
example
=
new
MaterialExample
();
example
.
createCriteria
().
andIdIn
(
ids
);
return
materialMapper
.
updateByExampleSelective
(
material
,
example
);
int
result
=
0
;
try
{
result
=
materialMapper
.
updateByExampleSelective
(
material
,
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
result
;
}
public
String
findUnitName
(
Long
mId
){
return
materialMapperEx
.
findUnitName
(
mId
);
public
String
findUnitName
(
Long
mId
)
throws
Exception
{
String
result
=
null
;
try
{
result
=
materialMapperEx
.
findUnitName
(
mId
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
result
;
}
public
List
<
MaterialVo4Unit
>
findById
(
Long
id
){
return
materialMapperEx
.
findById
(
id
);
public
List
<
MaterialVo4Unit
>
findById
(
Long
id
)
throws
Exception
{
List
<
MaterialVo4Unit
>
list
=
null
;
try
{
list
=
materialMapperEx
.
findById
(
id
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
MaterialVo4Unit
>
findBySelect
(){
return
materialMapperEx
.
findBySelect
();
public
List
<
MaterialVo4Unit
>
findBySelect
()
throws
Exception
{
List
<
MaterialVo4Unit
>
list
=
null
;
try
{
list
=
materialMapperEx
.
findBySelect
();
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
Material
>
findByOrder
(){
public
List
<
Material
>
findByOrder
()
throws
Exception
{
MaterialExample
example
=
new
MaterialExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Name,Model asc"
);
return
materialMapper
.
selectByExample
(
example
);
List
<
Material
>
list
=
null
;
try
{
list
=
materialMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
MaterialVo4Unit
>
findByAll
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
)
{
public
List
<
MaterialVo4Unit
>
findByAll
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
)
throws
Exception
{
List
<
MaterialVo4Unit
>
resList
=
new
ArrayList
<
MaterialVo4Unit
>();
List
<
MaterialVo4Unit
>
list
=
materialMapperEx
.
findByAll
(
name
,
model
,
categoryId
,
categoryIds
);
List
<
MaterialVo4Unit
>
list
=
null
;
try
{
list
=
materialMapperEx
.
findByAll
(
name
,
model
,
categoryId
,
categoryIds
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
if
(
null
!=
list
)
{
for
(
MaterialVo4Unit
m
:
list
)
{
resList
.
add
(
m
);
...
...
@@ -205,6 +346,8 @@ public class MaterialService {
info
.
code
=
200
;
data
.
put
(
"message"
,
"成功"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
e
.
printStackTrace
();
info
.
code
=
500
;
data
.
put
(
"message"
,
e
.
getMessage
());
...
...
@@ -213,8 +356,17 @@ public class MaterialService {
return
info
;
}
public
List
<
Material
>
getMaterialEnableSerialNumberList
(
Map
<
String
,
Object
>
parameterMap
)
{
return
materialMapperEx
.
getMaterialEnableSerialNumberList
(
parameterMap
);
public
List
<
Material
>
getMaterialEnableSerialNumberList
(
Map
<
String
,
Object
>
parameterMap
)
throws
Exception
{
List
<
Material
>
list
=
null
;
try
{
list
=
materialMapperEx
.
getMaterialEnableSerialNumberList
(
parameterMap
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterialByIds
(
String
ids
)
throws
Exception
{
...
...
@@ -223,7 +375,16 @@ public class MaterialService {
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
materialMapperEx
.
batchDeleteMaterialByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
int
result
=
0
;
try
{
result
=
materialMapperEx
.
batchDeleteMaterialByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
/**
* create by: qiankunpingtai
...
...
@@ -250,7 +411,15 @@ public class MaterialService {
/**
* 校验单据子表 jsh_depotitem
* */
List
<
DepotItem
>
depotItemList
=
depotItemMapperEx
.
getDepotItemListListByMaterialIds
(
idArray
);
List
<
DepotItem
>
depotItemList
=
null
;
try
{
depotItemList
=
depotItemMapperEx
.
getDepotItemListListByMaterialIds
(
idArray
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
if
(
depotItemList
!=
null
&&
depotItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,MaterialIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
...
...
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