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
a184aabd
Commit
a184aabd
authored
Apr 10, 2019
by
乾坤平台
Committed by
季圣华
Apr 10, 2019
Browse files
!48 修改注册时本地事务和远程调用问题
Merge pull request !48 from 乾坤平台/master
parents
6f379739
bce05cf0
Changes
35
Show whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
View file @
a184aabd
...
...
@@ -115,4 +115,12 @@ public interface DepotHeadMapperEx {
Long
getBuildOnlyNumber
(
@Param
(
"seq_name"
)
String
seq_name
);
int
batchDeleteDepotHeadByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
List
<
DepotHead
>
getDepotHeadListByAccountIds
(
@Param
(
"accountIds"
)
String
[]
accountIds
);
List
<
DepotHead
>
getDepotHeadListByOrganIds
(
@Param
(
"organIds"
)
String
[]
organIds
);
List
<
DepotHead
>
getDepotHeadListByHandsPersonIds
(
@Param
(
"handsPersonIds"
)
String
[]
handsPersonIds
);
List
<
DepotHead
>
getDepotHeadListByDepotIds
(
@Param
(
"depotIds"
)
String
[]
depotIds
);
}
src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java
View file @
a184aabd
...
...
@@ -168,4 +168,8 @@ public interface DepotItemMapperEx {
int
batchDeleteDepotItemByDepotHeadIds
(
@Param
(
"depotheadIds"
)
Long
[]
depotHeadIds
);
int
batchDeleteDepotItemByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
List
<
DepotItem
>
getDepotItemListListByDepotIds
(
@Param
(
"depotIds"
)
String
[]
depotIds
);
List
<
DepotItem
>
getDepotItemListListByMaterialIds
(
@Param
(
"materialIds"
)
String
[]
materialIds
);
}
src/main/java/com/jsh/erp/service/account/AccountService.java
View file @
a184aabd
package
com.jsh.erp.service.account
;
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.*
;
import
com.jsh.erp.datasource.mappers.*
;
import
com.jsh.erp.datasource.vo.AccountVo4InOutList
;
import
com.jsh.erp.datasource.vo.AccountVo4List
;
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
;
...
...
@@ -38,13 +41,19 @@ public class AccountService {
@Resource
private
DepotHeadMapper
depotHeadMapper
;
@Resource
private
DepotHeadMapperEx
depotHeadMapperEx
;
@Resource
private
AccountHeadMapper
accountHeadMapper
;
@Resource
private
AccountHeadMapperEx
accountHeadMapperEx
;
@Resource
private
AccountItemMapper
accountItemMapper
;
@Resource
private
AccountItemMapperEx
accountItemMapperEx
;
@Resource
private
LogService
logService
;
@Resource
private
UserService
userService
;
...
...
@@ -330,4 +339,64 @@ public class AccountService {
String
[]
idArray
=
ids
.
split
(
","
);
return
accountMapperEx
.
batchDeleteAccountByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 10:31
* @Param: ids
* @return int
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountByIdsNormal
(
String
ids
)
throws
Exception
{
/**
* 校验:
* 1、财务主表 jsh_accounthead
* 2、财务子表 jsh_accountitem
* 3、单据主表 jsh_depothead
* 是否有相关数据
* */
int
deleteTotal
=
0
;
if
(
StringUtils
.
isEmpty
(
ids
)){
return
deleteTotal
;
}
String
[]
idArray
=
ids
.
split
(
","
);
/**
* 校验财务主表 jsh_accounthead
* */
List
<
AccountHead
>
accountHeadList
=
accountHeadMapperEx
.
getAccountHeadListByAccountIds
(
idArray
);
if
(
accountHeadList
!=
null
&&
accountHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,AccountIds[{}]"
,
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_accountitem
* */
List
<
AccountItem
>
accountItemList
=
accountItemMapperEx
.
getAccountItemListByAccountIds
(
idArray
);
if
(
accountItemList
!=
null
&&
accountItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,AccountIds[{}]"
,
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
.
getDepotHeadListByAccountIds
(
idArray
);
if
(
depotHeadList
!=
null
&&
depotHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,AccountIds[{}]"
,
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
=
batchDeleteAccountByIds
(
ids
);
return
deleteTotal
;
}
}
src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java
View file @
a184aabd
package
com.jsh.erp.service.accountHead
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.AccountHead
;
import
com.jsh.erp.datasource.entities.AccountHeadExample
;
import
com.jsh.erp.datasource.entities.AccountHeadVo4ListEx
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.mappers.AccountHeadMapper
;
import
com.jsh.erp.datasource.mappers.AccountHeadMapperEx
;
import
com.jsh.erp.datasource.mappers.AccountItemMapperEx
;
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
;
import
com.jsh.erp.utils.Tools
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
...
...
@@ -39,6 +39,8 @@ public class AccountHeadService {
private
UserService
userService
;
@Resource
private
LogService
logService
;
@Resource
private
AccountItemMapperEx
accountItemMapperEx
;
public
AccountHead
getAccountHead
(
long
id
)
{
return
accountHeadMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -142,4 +144,41 @@ public class AccountHeadService {
String
[]
idArray
=
ids
.
split
(
","
);
return
accountHeadMapperEx
.
batchDeleteAccountHeadByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 15:49
* @Param: ids
* @return int
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountHeadByIdsNormal
(
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
.
getAccountItemListByHeaderIds
(
idArray
);
if
(
accountItemList
!=
null
&&
accountItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,HeaderIds[{}]"
,
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
=
batchDeleteAccountHeadByIds
(
ids
);
return
deleteTotal
;
}
}
src/main/java/com/jsh/erp/service/depot/DepotService.java
View file @
a184aabd
package
com.jsh.erp.service.depot
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Depot
;
import
com.jsh.erp.datasource.entities.DepotEx
;
import
com.jsh.erp.datasource.entities.DepotExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.DepotMapper
;
import
com.jsh.erp.datasource.mappers.DepotMapperEx
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.mappers.*
;
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
;
...
...
@@ -37,6 +36,10 @@ public class DepotService {
private
UserService
userService
;
@Resource
private
LogService
logService
;
@Resource
private
DepotHeadMapperEx
depotHeadMapperEx
;
@Resource
private
DepotItemMapperEx
depotItemMapperEx
;
public
Depot
getDepot
(
long
id
)
{
return
depotMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -122,4 +125,54 @@ public class DepotService {
String
[]
idArray
=
ids
.
split
(
","
);
return
depotMapperEx
.
batchDeleteDepotByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 16:52
* @Param: ids
* @return int
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepotByIdsNormal
(
String
ids
)
throws
Exception
{
/**
* 校验
* 1、单据主表 jsh_depothead
* 2、单据子表 jsh_depotitem
* 是否有相关数据
* */
int
deleteTotal
=
0
;
if
(
StringUtils
.
isEmpty
(
ids
)){
return
deleteTotal
;
}
String
[]
idArray
=
ids
.
split
(
","
);
/**
* 校验单据主表 jsh_depothead
* */
List
<
DepotHead
>
depotHeadList
=
depotHeadMapperEx
.
getDepotHeadListByDepotIds
(
idArray
);
if
(
depotHeadList
!=
null
&&
depotHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,DepotIds[{}]"
,
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_depotitem
* */
List
<
DepotItem
>
depotItemList
=
depotItemMapperEx
.
getDepotItemListListByDepotIds
(
idArray
);
if
(
depotItemList
!=
null
&&
depotItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,DepotIds[{}]"
,
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
=
batchDeleteDepotByIds
(
ids
);
return
deleteTotal
;
}
}
src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java
View file @
a184aabd
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/java/com/jsh/erp/service/material/MaterialService.java
View file @
a184aabd
package
com.jsh.erp.service.material
;
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.*
;
import
com.jsh.erp.datasource.mappers.DepotItemMapperEx
;
import
com.jsh.erp.datasource.mappers.MaterialMapper
;
import
com.jsh.erp.datasource.mappers.MaterialMapperEx
;
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.BaseResponseInfo
;
...
...
@@ -32,6 +36,8 @@ public class MaterialService {
private
LogService
logService
;
@Resource
private
UserService
userService
;
@Resource
private
DepotItemMapperEx
depotItemMapperEx
;
public
Material
getMaterial
(
long
id
)
{
return
materialMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -217,4 +223,43 @@ public class MaterialService {
String
[]
idArray
=
ids
.
split
(
","
);
return
materialMapperEx
.
batchDeleteMaterialByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 18:00
* @Param: ids
* @return int
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterialByIdsNormal
(
String
ids
)
throws
Exception
{
/**
* 校验
* 1、单据子表 jsh_depotitem
* 是否有相关数据
* */
int
deleteTotal
=
0
;
if
(
StringUtils
.
isEmpty
(
ids
)){
return
deleteTotal
;
}
String
[]
idArray
=
ids
.
split
(
","
);
/**
* 校验单据子表 jsh_depotitem
* */
List
<
DepotItem
>
depotItemList
=
depotItemMapperEx
.
getDepotItemListListByMaterialIds
(
idArray
);
if
(
depotItemList
!=
null
&&
depotItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,MaterialIds[{}]"
,
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
=
batchDeleteMaterialByIds
(
ids
);
return
deleteTotal
;
}
}
src/main/java/com/jsh/erp/service/person/PersonService.java
View file @
a184aabd
package
com.jsh.erp.service.person
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Person
;
import
com.jsh.erp.datasource.entities.PersonExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
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.PersonMapperEx
;
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 +38,10 @@ public class PersonService {
private
UserService
userService
;
@Resource
private
LogService
logService
;
@Resource
private
AccountHeadMapperEx
accountHeadMapperEx
;
@Resource
private
DepotHeadMapperEx
depotHeadMapperEx
;
public
Person
getPerson
(
long
id
)
{
return
personMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -117,4 +124,52 @@ public class PersonService {
String
[]
idArray
=
ids
.
split
(
","
);
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
)
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
.
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 @
a184aabd
package
com.jsh.erp.service.supplier
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Supplier
;
import
com.jsh.erp.datasource.entities.SupplierExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
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.SupplierMapperEx
;
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.BaseResponseInfo
;
...
...
@@ -39,6 +42,10 @@ public class SupplierService {
private
LogService
logService
;
@Resource
private
UserService
userService
;
@Resource
private
AccountHeadMapperEx
accountHeadMapperEx
;
@Resource
private
DepotHeadMapperEx
depotHeadMapperEx
;
public
Supplier
getSupplier
(
long
id
)
{
return
supplierMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -187,4 +194,53 @@ public class SupplierService {
String
[]
idArray
=
ids
.
split
(
","
);
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/java/com/jsh/erp/service/user/UserService.java
View file @
a184aabd
package
com.jsh.erp.service.user
;
import
com.alibaba.druid.util.StringUtils
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
...
...
@@ -15,6 +16,7 @@ import com.jsh.erp.datasource.vo.TreeNodeEx;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.utils.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -42,6 +44,12 @@ public class UserService {
private
OrgaUserRelService
orgaUserRelService
;
@Resource
private
LogService
logService
;
@Resource
private
UserService
userService
;
@Resource
private
UserBusinessService
userBusinessService
;
public
User
getUser
(
long
id
)
{
return
userMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -272,7 +280,14 @@ public class UserService {
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
UserEx
registerUser
(
UserEx
ue
)
throws
Exception
{
public
UserEx
registerUser
(
UserEx
ue
,
Integer
manageRoleId
)
throws
Exception
{
/**
* create by: qiankunpingtai
* create time: 2019/4/9 18:00
* website:https://qiankunpingtai.cn
* description:
* 多次创建事务,事物之间无法协同,应该在入口处创建一个事务以做协调
*/
ue
.
setPassword
(
Tools
.
md5Encryp
(
ue
.
getPassword
()));
ue
.
setIsystem
(
BusinessConstants
.
USER_NOT_SYSTEM
);
if
(
ue
.
getIsmanager
()==
null
){
...
...
@@ -280,6 +295,19 @@ public class UserService {
}
ue
.
setStatus
(
BusinessConstants
.
USER_STATUS_NORMAL
);
int
i
=
userMapperEx
.
addUser
(
ue
);
//更新租户id
User
user
=
new
User
();
user
.
setId
(
ue
.
getId
());
user
.
setTenantId
(
ue
.
getId
());
userService
.
updateUserTenant
(
user
);
//新增用户与角色的关系
JSONObject
ubObj
=
new
JSONObject
();
ubObj
.
put
(
"type"
,
"UserRole"
);
ubObj
.
put
(
"keyid"
,
ue
.
getId
());
JSONArray
ubArr
=
new
JSONArray
();
ubArr
.
add
(
manageRoleId
);
ubObj
.
put
(
"value"
,
ubArr
.
toString
());
userBusinessService
.
insertUserBusiness
(
ubObj
.
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
if
(
i
>
0
){
return
ue
;
}
...
...
src/main/resources/application.properties
View file @
a184aabd
...
...
@@ -7,7 +7,7 @@ spring.datasource.password=123456
project
=
src/main/java
resource
=
src/main/resources
web.front.baseDir
=
erp_web
mybatis.type-aliases-package
=
com.
chinamobile.model
.*
mybatis.type-aliases-package
=
com.
jsh.erp.datasource.entities
.*
mybatis.mapper-locations
=
classpath:./mapper_xml/*.xml
#开启sql打印
logging.level.com.jsh.erp.datasource.mappers
=
DEBUG
...
...
src/main/resources/mapper_xml/AccountHeadMapperEx.xml
View file @
a184aabd
...
...
@@ -88,4 +88,28 @@
</foreach>
)
</update>
<select
id=
"getAccountHeadListByOrganIds"
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 organId in (
<foreach
collection=
"organIds"
item=
"organId"
separator=
","
>
#{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>
)
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper>
\ No newline at end of file
src/main/resources/mapper_xml/AccountItemMapperEx.xml
View file @
a184aabd
...
...
@@ -60,4 +60,40 @@
</foreach>
)
</update>
<select
id=
"getAccountItemListByAccountIds"
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 accountId in (
<foreach
collection=
"accountIds"
item=
"accountId"
separator=
","
>
#{accountId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select
id=
"getAccountItemListByHeaderIds"
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 headerId in (
<foreach
collection=
"headerIds"
item=
"headerId"
separator=
","
>
#{headerId}
</foreach>
)
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
src/main/resources/mapper_xml/DepotHeadMapperEx.xml
View file @
a184aabd
...
...
@@ -438,5 +438,61 @@
</foreach>
)
</update>
<select
id=
"getDepotHeadListByAccountIds"
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 accountId in (
<foreach
collection=
"accountIds"
item=
"accountId"
separator=
","
>
#{accountId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</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>
<select
id=
"getDepotHeadListByDepotIds"
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
(ProjectId in (
<foreach
collection=
"depotIds"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
OR
AllocationProjectId in (
<foreach
collection=
"depotIds"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
)
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper>
\ No newline at end of file
src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
a184aabd
...
...
@@ -411,6 +411,30 @@
</foreach>
)
</update>
<select
id=
"getDepotItemListListByDepotIds"
resultMap=
"com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap"
>
select
<include
refid=
"com.jsh.erp.datasource.mappers.DepotItemMapper.Base_Column_List"
/>
from jsh_depotitem
where 1=1
and DepotId in (
<foreach
collection=
"depotIds"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select
id=
"getDepotItemListListByMaterialIds"
resultMap=
"com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap"
>
select
<include
refid=
"com.jsh.erp.datasource.mappers.DepotItemMapper.Base_Column_List"
/>
from jsh_depotitem
where 1=1
and materialId in (
<foreach
collection=
"materialIds"
item=
"materialId"
separator=
","
>
#{materialId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
...
...
Prev
1
2
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