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
d91db76e
Commit
d91db76e
authored
Apr 10, 2019
by
qiankunpingtai
Browse files
去除外键之供应商客户信息表jsh_supplier、经手人表jsh_person相关修改
parent
76034a12
Changes
11
Hide whitespace changes
Inline
Side-by-side
erp_web/js/pages/manage/supplier.js
View file @
d91db76e
...
@@ -179,7 +179,17 @@
...
@@ -179,7 +179,17 @@
if
(
res
&&
res
.
code
==
200
)
{
if
(
res
&&
res
.
code
==
200
)
{
$
(
"
#searchBtn
"
).
click
();
$
(
"
#searchBtn
"
).
click
();
}
else
{
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除信息失败,请稍后再试!
'
,
'
error
'
);
if
(
res
&&
res
.
code
==
601
){
var
jsondata
=
{};
jsondata
.
ids
=
supplierTotalInfo
[
0
];
jsondata
.
deleteType
=
'
2
'
;
var
type
=
'
single
'
;
batDeleteSupplierForceConfirm
(
res
,
"
/supplier/batchDeleteSupplierByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除信息失败,请稍后再试!
'
,
'
error
'
);
}
}
}
},
},
//此处添加错误处理
//此处添加错误处理
...
@@ -224,7 +234,17 @@
...
@@ -224,7 +234,17 @@
$
(
"
#searchBtn
"
).
click
();
$
(
"
#searchBtn
"
).
click
();
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
}
else
{
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除信息失败,请稍后再试!
'
,
'
error
'
);
if
(
res
&&
res
.
code
==
601
){
var
jsondata
=
{};
jsondata
.
ids
=
ids
;
jsondata
.
deleteType
=
'
2
'
;
var
type
=
'
batch
'
;
batDeleteSupplierForceConfirm
(
res
,
"
/supplier/batchDeleteSupplierByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除信息失败,请稍后再试!
'
,
'
error
'
);
}
}
}
},
},
//此处添加错误处理
//此处添加错误处理
...
@@ -237,6 +257,38 @@
...
@@ -237,6 +257,38 @@
});
});
}
}
}
}
/**
* 确认强制删除
* */
function
batDeleteSupplierForceConfirm
(
res
,
url
,
jsondata
)
{
$
.
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
;
}
});
}
});
}
//批量启用
//批量启用
function
setEnableFun
()
{
function
setEnableFun
()
{
...
...
erp_web/pages/manage/account.html
View file @
d91db76e
...
@@ -238,7 +238,10 @@
...
@@ -238,7 +238,10 @@
var
jsondata
=
{};
var
jsondata
=
{};
jsondata
.
ids
=
accountTotalInfo
[
0
];
jsondata
.
ids
=
accountTotalInfo
[
0
];
jsondata
.
deleteType
=
'
2
'
;
jsondata
.
deleteType
=
'
2
'
;
batDeleteAccountForceConfirm
(
res
,
"
/account/batchDeleteAccountByIds
"
,
jsondata
);
var
type
=
'
single
'
;
batDeleteAccountForceConfirm
(
res
,
"
/account/batchDeleteAccountByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户失败,请稍后再试!
'
,
'
error
'
);
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户失败,请稍后再试!
'
,
'
error
'
);
}
}
...
@@ -289,7 +292,10 @@
...
@@ -289,7 +292,10 @@
var
jsondata
=
{};
var
jsondata
=
{};
jsondata
.
ids
=
ids
;
jsondata
.
ids
=
ids
;
jsondata
.
deleteType
=
'
2
'
;
jsondata
.
deleteType
=
'
2
'
;
batDeleteAccountForceConfirm
(
res
,
"
/account/batchDeleteAccountByIds
"
,
jsondata
);
var
type
=
'
batch
'
;
batDeleteAccountForceConfirm
(
res
,
"
/account/batchDeleteAccountByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户失败,请稍后再试!
'
,
'
error
'
);
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户失败,请稍后再试!
'
,
'
error
'
);
}
}
...
@@ -308,7 +314,7 @@
...
@@ -308,7 +314,7 @@
/**
/**
* 确认强制删除
* 确认强制删除
* */
* */
function
batDeleteAccountForceConfirm
(
res
,
url
,
jsondata
)
{
function
batDeleteAccountForceConfirm
(
res
,
url
,
jsondata
,
type
)
{
$
.
messager
.
confirm
(
'
删除确认
'
,
res
.
msg
,
function
(
r
)
{
$
.
messager
.
confirm
(
'
删除确认
'
,
res
.
msg
,
function
(
r
)
{
if
(
r
)
{
if
(
r
)
{
$
.
ajax
({
$
.
ajax
({
...
@@ -319,7 +325,12 @@
...
@@ -319,7 +325,12 @@
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
==
200
)
{
if
(
res
&&
res
.
code
==
200
)
{
$
(
"
#searchBtn
"
).
click
();
$
(
"
#searchBtn
"
).
click
();
}
else
{
if
(
type
==
'
batch
'
){
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
}
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户失败,请稍后再试!
'
,
'
error
'
);
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户失败,请稍后再试!
'
,
'
error
'
);
}
}
},
},
...
...
erp_web/pages/materials/person.html
View file @
d91db76e
...
@@ -258,7 +258,17 @@
...
@@ -258,7 +258,17 @@
if
(
res
&&
res
.
code
==
200
)
{
if
(
res
&&
res
.
code
==
200
)
{
$
(
"
#searchBtn
"
).
click
();
$
(
"
#searchBtn
"
).
click
();
}
else
{
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除经手人信息失败,请稍后再试!
'
,
'
error
'
);
if
(
res
&&
res
.
code
==
601
){
var
jsondata
=
{};
jsondata
.
ids
=
personID
;
jsondata
.
deleteType
=
'
2
'
;
var
type
=
'
single
'
;
batDeletePersonForceConfirm
(
res
,
"
/person/batchDeletePersonByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除经手人信息失败,请稍后再试!
'
,
'
error
'
);
}
}
}
},
},
//此处添加错误处理
//此处添加错误处理
...
@@ -303,7 +313,17 @@
...
@@ -303,7 +313,17 @@
$
(
"
#searchBtn
"
).
click
();
$
(
"
#searchBtn
"
).
click
();
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
}
else
{
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除经手人信息失败,请稍后再试!
'
,
'
error
'
);
if
(
res
&&
res
.
code
==
601
){
var
jsondata
=
{};
jsondata
.
ids
=
personID
;
jsondata
.
deleteType
=
'
2
'
;
var
type
=
'
batch
'
;
batDeletePersonForceConfirm
(
res
,
"
/person/batchDeletePersonByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除经手人信息失败,请稍后再试!
'
,
'
error
'
);
}
}
}
},
},
//此处添加错误处理
//此处添加错误处理
...
@@ -316,6 +336,38 @@
...
@@ -316,6 +336,38 @@
});
});
}
}
}
}
/**
* 确认强制删除
* */
function
batDeletePersonForceConfirm
(
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
;
var
url
;
...
...
src/main/java/com/jsh/erp/controller/PersonController.java
View file @
d91db76e
...
@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
...
@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.Person
;
import
com.jsh.erp.datasource.entities.Person
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
...
@@ -133,9 +134,20 @@ public class PersonController {
...
@@ -133,9 +134,20 @@ public class PersonController {
* @return java.lang.Object
* @return java.lang.Object
*/
*/
@RequestMapping
(
value
=
"/batchDeletePersonByIds"
)
@RequestMapping
(
value
=
"/batchDeletePersonByIds"
)
public
Object
batchDeletePersonByIds
(
@RequestParam
(
"ids"
)
String
ids
)
throws
Exception
{
public
Object
batchDeletePersonByIds
(
@RequestParam
(
"ids"
)
String
ids
,
@RequestParam
(
value
=
"deleteType"
,
required
=
false
,
defaultValue
=
BusinessConstants
.
DELETE_TYPE_NORMAL
)
String
deleteType
)
throws
Exception
{
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
int
i
=
personService
.
batchDeletePersonByIds
(
ids
);
int
i
=
0
;
if
(
BusinessConstants
.
DELETE_TYPE_NORMAL
.
equals
(
deleteType
)){
i
=
personService
.
batchDeletePersonByIdsNormal
(
ids
);
}
else
if
(
BusinessConstants
.
DELETE_TYPE_FORCE
.
equals
(
deleteType
)){
i
=
personService
.
batchDeletePersonByIds
(
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
){
if
(
i
<
1
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}]"
,
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}]"
,
ExceptionConstants
.
PERSON_DELETE_FAILED_CODE
,
ExceptionConstants
.
PERSON_DELETE_FAILED_MSG
,
ids
);
ExceptionConstants
.
PERSON_DELETE_FAILED_CODE
,
ExceptionConstants
.
PERSON_DELETE_FAILED_MSG
,
ids
);
...
...
src/main/java/com/jsh/erp/controller/SupplierController.java
View file @
d91db76e
...
@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
...
@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.Supplier
;
import
com.jsh.erp.datasource.entities.Supplier
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
...
@@ -452,9 +453,20 @@ public class SupplierController {
...
@@ -452,9 +453,20 @@ public class SupplierController {
* @return java.lang.Object
* @return java.lang.Object
*/
*/
@RequestMapping
(
value
=
"/batchDeleteSupplierByIds"
)
@RequestMapping
(
value
=
"/batchDeleteSupplierByIds"
)
public
Object
batchDeleteSupplierByIds
(
@RequestParam
(
"ids"
)
String
ids
)
throws
Exception
{
public
Object
batchDeleteSupplierByIds
(
@RequestParam
(
"ids"
)
String
ids
,
@RequestParam
(
value
=
"deleteType"
,
required
=
false
,
defaultValue
=
BusinessConstants
.
DELETE_TYPE_NORMAL
)
String
deleteType
)
throws
Exception
{
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
int
i
=
supplierService
.
batchDeleteSupplierByIds
(
ids
);
int
i
=
0
;
if
(
BusinessConstants
.
DELETE_TYPE_NORMAL
.
equals
(
deleteType
)){
i
=
supplierService
.
batchDeleteSupplierByIdsNormal
(
ids
);
}
else
if
(
BusinessConstants
.
DELETE_TYPE_FORCE
.
equals
(
deleteType
)){
i
=
supplierService
.
batchDeleteSupplierByIds
(
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
){
if
(
i
<
1
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}]"
,
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}]"
,
ExceptionConstants
.
SUPPLIER_DELETE_FAILED_CODE
,
ExceptionConstants
.
SUPPLIER_DELETE_FAILED_MSG
,
ids
);
ExceptionConstants
.
SUPPLIER_DELETE_FAILED_CODE
,
ExceptionConstants
.
SUPPLIER_DELETE_FAILED_MSG
,
ids
);
...
...
src/main/java/com/jsh/erp/datasource/mappers/AccountHeadMapperEx.java
View file @
d91db76e
...
@@ -39,4 +39,8 @@ public interface AccountHeadMapperEx {
...
@@ -39,4 +39,8 @@ public interface AccountHeadMapperEx {
int
batchDeleteAccountHeadByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
[]
ids
);
int
batchDeleteAccountHeadByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
[]
ids
);
List
<
AccountHead
>
getAccountHeadListByAccountIds
(
@Param
(
"accountIds"
)
String
[]
accountIds
);
List
<
AccountHead
>
getAccountHeadListByAccountIds
(
@Param
(
"accountIds"
)
String
[]
accountIds
);
List
<
AccountHead
>
getAccountHeadListByOrganIds
(
@Param
(
"organIds"
)
String
[]
organIds
);
List
<
AccountHead
>
getAccountHeadListByHandsPersonIds
(
@Param
(
"handsPersonIds"
)
String
[]
handsPersonIds
);
}
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
View file @
d91db76e
...
@@ -117,4 +117,8 @@ public interface DepotHeadMapperEx {
...
@@ -117,4 +117,8 @@ public interface DepotHeadMapperEx {
int
batchDeleteDepotHeadByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
int
batchDeleteDepotHeadByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
List
<
DepotHead
>
getDepotHeadListByAccountIds
(
@Param
(
"accountIds"
)
String
[]
accountIds
);
List
<
DepotHead
>
getDepotHeadListByAccountIds
(
@Param
(
"accountIds"
)
String
[]
accountIds
);
List
<
DepotHead
>
getDepotHeadListByOrganIds
(
@Param
(
"organIds"
)
String
[]
organIds
);
List
<
DepotHead
>
getDepotHeadListByHandsPersonIds
(
@Param
(
"handsPersonIds"
)
String
[]
handsPersonIds
);
}
}
src/main/java/com/jsh/erp/service/person/PersonService.java
View file @
d91db76e
package
com.jsh.erp.service.person
;
package
com.jsh.erp.service.person
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Person
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.PersonExample
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.AccountHeadMapperEx
;
import
com.jsh.erp.datasource.mappers.DepotHeadMapperEx
;
import
com.jsh.erp.datasource.mappers.PersonMapper
;
import
com.jsh.erp.datasource.mappers.PersonMapper
;
import
com.jsh.erp.datasource.mappers.PersonMapperEx
;
import
com.jsh.erp.datasource.mappers.PersonMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
...
@@ -35,6 +38,10 @@ public class PersonService {
...
@@ -35,6 +38,10 @@ public class PersonService {
private
UserService
userService
;
private
UserService
userService
;
@Resource
@Resource
private
LogService
logService
;
private
LogService
logService
;
@Resource
private
AccountHeadMapperEx
accountHeadMapperEx
;
@Resource
private
DepotHeadMapperEx
depotHeadMapperEx
;
public
Person
getPerson
(
long
id
)
{
public
Person
getPerson
(
long
id
)
{
return
personMapper
.
selectByPrimaryKey
(
id
);
return
personMapper
.
selectByPrimaryKey
(
id
);
...
@@ -117,4 +124,52 @@ public class PersonService {
...
@@ -117,4 +124,52 @@ public class PersonService {
String
[]
idArray
=
ids
.
split
(
","
);
String
[]
idArray
=
ids
.
split
(
","
);
return
personMapperEx
.
batchDeletePersonByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
return
personMapperEx
.
batchDeletePersonByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 15:14
* @Param: ids
* @return int
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeletePersonByIdsNormal
(
String
ids
)
{
/**
* 校验
* 1、财务主表 jsh_accounthead
* 2、单据主表 jsh_depothead
* 是否有相关数据
* */
int
deleteTotal
=
0
;
if
(
StringUtils
.
isEmpty
(
ids
)){
return
deleteTotal
;
}
String
[]
idArray
=
ids
.
split
(
","
);
/**
* 校验财务主表 jsh_accounthead
* */
List
<
AccountHead
>
accountHeadList
=
accountHeadMapperEx
.
getAccountHeadListByHandsPersonIds
(
idArray
);
if
(
accountHeadList
!=
null
&&
accountHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
);
}
/**
* 校验单据主表 jsh_depothead
* */
List
<
DepotHead
>
depotHeadList
=
depotHeadMapperEx
.
getDepotHeadListByHandsPersonIds
(
idArray
);
if
(
depotHeadList
!=
null
&&
depotHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]"
,
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
=
batchDeletePersonByIds
(
ids
);
return
deleteTotal
;
}
}
}
src/main/java/com/jsh/erp/service/supplier/SupplierService.java
View file @
d91db76e
package
com.jsh.erp.service.supplier
;
package
com.jsh.erp.service.supplier
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Supplier
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.SupplierExample
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.AccountHeadMapperEx
;
import
com.jsh.erp.datasource.mappers.DepotHeadMapperEx
;
import
com.jsh.erp.datasource.mappers.SupplierMapper
;
import
com.jsh.erp.datasource.mappers.SupplierMapper
;
import
com.jsh.erp.datasource.mappers.SupplierMapperEx
;
import
com.jsh.erp.datasource.mappers.SupplierMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.BaseResponseInfo
;
...
@@ -39,6 +42,10 @@ public class SupplierService {
...
@@ -39,6 +42,10 @@ public class SupplierService {
private
LogService
logService
;
private
LogService
logService
;
@Resource
@Resource
private
UserService
userService
;
private
UserService
userService
;
@Resource
private
AccountHeadMapperEx
accountHeadMapperEx
;
@Resource
private
DepotHeadMapperEx
depotHeadMapperEx
;
public
Supplier
getSupplier
(
long
id
)
{
public
Supplier
getSupplier
(
long
id
)
{
return
supplierMapper
.
selectByPrimaryKey
(
id
);
return
supplierMapper
.
selectByPrimaryKey
(
id
);
...
@@ -187,4 +194,53 @@ public class SupplierService {
...
@@ -187,4 +194,53 @@ public class SupplierService {
String
[]
idArray
=
ids
.
split
(
","
);
String
[]
idArray
=
ids
.
split
(
","
);
return
supplierMapperEx
.
batchDeleteSupplierByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
return
supplierMapperEx
.
batchDeleteSupplierByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
*正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 14:48
* @Param: ids
* @return int
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteSupplierByIdsNormal
(
String
ids
)
throws
Exception
{
/**
* 校验
* 1、财务主表 jsh_accounthead
* 2、单据主表 jsh_depothead
* 是否有相关数据
* */
int
deleteTotal
=
0
;
if
(
StringUtils
.
isEmpty
(
ids
)){
return
deleteTotal
;
}
String
[]
idArray
=
ids
.
split
(
","
);
/**
* 校验财务主表 jsh_accounthead
* */
List
<
AccountHead
>
accountHeadList
=
accountHeadMapperEx
.
getAccountHeadListByOrganIds
(
idArray
);
if
(
accountHeadList
!=
null
&&
accountHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,OrganIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
);
}
/**
* 校验单据主表 jsh_depothead
* */
List
<
DepotHead
>
depotHeadList
=
depotHeadMapperEx
.
getDepotHeadListByOrganIds
(
idArray
);
if
(
depotHeadList
!=
null
&&
depotHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,OrganIds[{}]"
,
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
=
batchDeleteSupplierByIds
(
ids
);
return
deleteTotal
;
}
}
}
src/main/resources/mapper_xml/AccountHeadMapperEx.xml
View file @
d91db76e
...
@@ -88,14 +88,26 @@
...
@@ -88,14 +88,26 @@
</foreach>
</foreach>
)
)
</update>
</update>
<select
id=
"getAccountHeadListBy
Account
Ids"
resultMap=
"com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap"
>
<select
id=
"getAccountHeadListBy
Organ
Ids"
resultMap=
"com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap"
>
select
select
<include
refid=
"com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List"
/>
<include
refid=
"com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List"
/>
from jsh_accounthead
from jsh_accounthead
where 1=1
where 1=1
and accountId in (
and organId in (
<foreach
collection=
"accountIds"
item=
"accountId"
separator=
","
>
<foreach
collection=
"organIds"
item=
"organId"
separator=
","
>
#{accountId}
#{organId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select
id=
"getAccountHeadListByHandsPersonIds"
resultMap=
"com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap"
>
select
<include
refid=
"com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List"
/>
from jsh_accounthead
where 1=1
and handsPersonId in (
<foreach
collection=
"handsPersonIds"
item=
"handsPersonId"
separator=
","
>
#{handsPersonId}
</foreach>
</foreach>
)
)
and ifnull(delete_Flag,'0') !='1'
and ifnull(delete_Flag,'0') !='1'
...
...
src/main/resources/mapper_xml/DepotHeadMapperEx.xml
View file @
d91db76e
...
@@ -450,5 +450,29 @@
...
@@ -450,5 +450,29 @@
)
)
and ifnull(delete_Flag,'0') !='1'
and ifnull(delete_Flag,'0') !='1'
</select>
</select>
<select
id=
"getDepotHeadListByOrganIds"
resultMap=
"com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap"
>
select
<include
refid=
"com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List"
/>
from jsh_depothead
where 1=1
and organId in (
<foreach
collection=
"organIds"
item=
"organId"
separator=
","
>
#{organId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select
id=
"getDepotHeadListByHandsPersonIds"
resultMap=
"com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap"
>
select
<include
refid=
"com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List"
/>
from jsh_depothead
where 1=1
and handsPersonId in (
<foreach
collection=
"handsPersonIds"
item=
"handsPersonId"
separator=
","
>
#{handsPersonId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper>
</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