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
bb1f9b7e
Commit
bb1f9b7e
authored
Apr 10, 2019
by
qiankunpingtai
Browse files
去除外键之收支项目表jsh_inoutitem相关修改
parent
89b42d34
Changes
5
Hide whitespace changes
Inline
Side-by-side
erp_web/pages/manage/inOutItem.html
View file @
bb1f9b7e
...
...
@@ -234,7 +234,17 @@
if
(
res
&&
res
.
code
==
200
)
{
$
(
"
#searchBtn
"
).
click
();
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除收支项目失败,请稍后再试!
'
,
'
error
'
);
if
(
res
&&
res
.
code
==
601
){
var
jsondata
=
{};
jsondata
.
ids
=
inOutItemTotalInfo
[
0
];
jsondata
.
deleteType
=
'
2
'
;
var
type
=
'
single
'
;
batDeleteInOutItemForceConfirm
(
res
,
"
/inOutItem/batchDeleteInOutItemByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户失败,请稍后再试!
'
,
'
error
'
);
}
}
},
//此处添加错误处理
...
...
@@ -278,7 +288,17 @@
$
(
"
#searchBtn
"
).
click
();
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除收支项目失败,请稍后再试!
'
,
'
error
'
);
if
(
res
&&
res
.
code
==
601
){
var
jsondata
=
{};
jsondata
.
ids
=
ids
;
jsondata
.
deleteType
=
'
2
'
;
var
type
=
'
batch
'
;
batDeleteInOutItemForceConfirm
(
res
,
"
/inOutItem/batchDeleteInOutItemByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户失败,请稍后再试!
'
,
'
error
'
);
}
}
},
//此处添加错误处理
...
...
@@ -291,6 +311,38 @@
});
}
}
/**
* 确认强制删除
* */
function
batDeleteInOutItemForceConfirm
(
res
,
url
,
jsondata
,
type
)
{
$
.
messager
.
confirm
(
'
删除确认
'
,
res
.
msg
,
function
(
r
)
{
if
(
r
)
{
$
.
ajax
({
type
:
"
post
"
,
url
:
url
,
dataType
:
"
json
"
,
data
:
(
jsondata
),
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
==
200
)
{
$
(
"
#searchBtn
"
).
click
();
if
(
type
==
'
batch
'
){
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
}
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除收支项目失败,请稍后再试!
'
,
'
error
'
);
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除收支项目失败,请稍后再试!
'
,
'
error
'
);
return
;
}
});
}
});
}
//增加收支项目
var
url
;
...
...
src/main/java/com/jsh/erp/controller/InOutItemController.java
View file @
bb1f9b7e
...
...
@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.InOutItem
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
...
...
@@ -66,9 +67,20 @@ public class InOutItemController {
* @return java.lang.Object
*/
@RequestMapping
(
value
=
"/batchDeleteInOutItemByIds"
)
public
Object
batchDeleteInOutItemByIds
(
@RequestParam
(
"ids"
)
String
ids
)
throws
Exception
{
public
Object
batchDeleteInOutItemByIds
(
@RequestParam
(
"ids"
)
String
ids
,
@RequestParam
(
value
=
"deleteType"
,
required
=
false
,
defaultValue
=
BusinessConstants
.
DELETE_TYPE_NORMAL
)
String
deleteType
)
throws
Exception
{
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
int
i
=
inOutItemService
.
batchDeleteInOutItemByIds
(
ids
);
int
i
=
0
;
if
(
BusinessConstants
.
DELETE_TYPE_NORMAL
.
equals
(
deleteType
)){
i
=
inOutItemService
.
batchDeleteInOutItemByIdsNormal
(
ids
);
}
else
if
(
BusinessConstants
.
DELETE_TYPE_FORCE
.
equals
(
deleteType
)){
i
=
inOutItemService
.
batchDeleteInOutItemByIds
(
ids
);
}
else
{
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]"
,
ExceptionConstants
.
DELETE_REFUSED_CODE
,
ExceptionConstants
.
DELETE_REFUSED_MSG
,
ids
,
deleteType
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DELETE_REFUSED_CODE
,
ExceptionConstants
.
DELETE_REFUSED_MSG
);
}
if
(
i
<
1
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}]"
,
ExceptionConstants
.
IN_OUT_ITEM_DELETE_FAILED_CODE
,
ExceptionConstants
.
IN_OUT_ITEM_DELETE_FAILED_MSG
,
ids
);
...
...
src/main/java/com/jsh/erp/datasource/mappers/AccountItemMapperEx.java
View file @
bb1f9b7e
...
...
@@ -30,4 +30,6 @@ public interface AccountItemMapperEx {
List
<
AccountItem
>
getAccountItemListByAccountIds
(
@Param
(
"accountIds"
)
String
[]
accountIds
);
List
<
AccountItem
>
getAccountItemListByHeaderIds
(
@Param
(
"headerIds"
)
String
[]
headerIds
);
List
<
AccountItem
>
getAccountItemListByInOutItemIds
(
@Param
(
"inOutItemIds"
)
String
[]
inOutItemIds
);
}
\ No newline at end of file
src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java
View file @
bb1f9b7e
package
com.jsh.erp.service.inOutItem
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.InOutItem
;
import
com.jsh.erp.datasource.entities.InOutItemExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.AccountItemMapperEx
;
import
com.jsh.erp.datasource.mappers.InOutItemMapper
;
import
com.jsh.erp.datasource.mappers.InOutItemMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
...
...
@@ -35,6 +40,8 @@ public class InOutItemService {
private
UserService
userService
;
@Resource
private
LogService
logService
;
@Resource
private
AccountItemMapperEx
accountItemMapperEx
;
public
InOutItem
getInOutItem
(
long
id
)
{
return
inOutItemMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -105,4 +112,42 @@ public class InOutItemService {
String
[]
idArray
=
ids
.
split
(
","
);
return
inOutItemMapperEx
.
batchDeleteInOutItemByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 16:23
* @Param: ids
* @return int
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteInOutItemByIdsNormal
(
String
ids
)
throws
Exception
{
/**
* 校验
* 1、财务子表 jsh_accountitem
* 是否有相关数据
* */
int
deleteTotal
=
0
;
if
(
StringUtils
.
isEmpty
(
ids
)){
return
deleteTotal
;
}
String
[]
idArray
=
ids
.
split
(
","
);
/**
* 校验财务子表 jsh_accountitem
* */
List
<
AccountItem
>
accountItemList
=
accountItemMapperEx
.
getAccountItemListByInOutItemIds
(
idArray
);
if
(
accountItemList
!=
null
&&
accountItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,InOutItemIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
);
}
/**
* 校验通过执行删除操作
* */
deleteTotal
=
batchDeleteInOutItemByIds
(
ids
);
return
deleteTotal
;
}
}
src/main/resources/mapper_xml/AccountItemMapperEx.xml
View file @
bb1f9b7e
...
...
@@ -84,4 +84,16 @@
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select
id=
"getAccountItemListByInOutItemIds"
resultMap=
"com.jsh.erp.datasource.mappers.AccountItemMapper.BaseResultMap"
>
select
<include
refid=
"com.jsh.erp.datasource.mappers.AccountItemMapper.Base_Column_List"
/>
from jsh_accountitem
where 1=1
and inOutItemId in (
<foreach
collection=
"inOutItemIds"
item=
"inOutItemId"
separator=
","
>
#{inOutItemId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper>
\ No newline at end of file
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