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
1a8b4d89
Commit
1a8b4d89
authored
Apr 01, 2019
by
乾坤平台
Committed by
季圣华
Apr 01, 2019
Browse files
!41 全局修改物理删除为逻辑删除,同时修改查询语句过滤删除标识
Merge pull request !41 from 乾坤平台/master
parents
35c6f559
1f2cf8c3
Changes
85
Show whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/datasource/mappers/MaterialPropertyMapperEx.java
View file @
1a8b4d89
...
...
@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.MaterialProperty;
import
com.jsh.erp.datasource.entities.MaterialPropertyExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
public
interface
MaterialPropertyMapperEx
{
...
...
@@ -14,4 +15,6 @@ public interface MaterialPropertyMapperEx {
@Param
(
"rows"
)
Integer
rows
);
Long
countsByMaterialProperty
(
@Param
(
"name"
)
String
name
);
int
batchDeleteMaterialPropertyByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/PersonMapperEx.java
View file @
1a8b4d89
...
...
@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Person;
import
com.jsh.erp.datasource.entities.PersonExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
public
interface
PersonMapperEx
{
...
...
@@ -17,4 +18,6 @@ public interface PersonMapperEx {
Long
countsByPerson
(
@Param
(
"name"
)
String
name
,
@Param
(
"type"
)
String
type
);
int
batchDeletePersonByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/RoleMapperEx.java
View file @
1a8b4d89
...
...
@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Role;
import
com.jsh.erp.datasource.entities.RoleExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
public
interface
RoleMapperEx
{
...
...
@@ -15,4 +16,6 @@ public interface RoleMapperEx {
Long
countsByRole
(
@Param
(
"name"
)
String
name
);
int
batchDeleteRoleByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/SupplierMapperEx.java
View file @
1a8b4d89
...
...
@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Supplier;
import
com.jsh.erp.datasource.entities.SupplierExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
public
interface
SupplierMapperEx
{
...
...
@@ -30,4 +31,6 @@ public interface SupplierMapperEx {
@Param
(
"phonenum"
)
String
phonenum
,
@Param
(
"telephone"
)
String
telephone
,
@Param
(
"description"
)
String
description
);
int
batchDeleteSupplierByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/SystemConfigMapperEx.java
View file @
1a8b4d89
...
...
@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.SystemConfig;
import
com.jsh.erp.datasource.entities.SystemConfigExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
public
interface
SystemConfigMapperEx
{
...
...
@@ -15,4 +16,6 @@ public interface SystemConfigMapperEx {
Long
countsBySystemConfig
(
@Param
(
"companyName"
)
String
companyName
);
int
batchDeleteSystemConfigByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/UnitMapperEx.java
View file @
1a8b4d89
...
...
@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Unit;
import
com.jsh.erp.datasource.entities.UnitExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
public
interface
UnitMapperEx
{
...
...
@@ -15,4 +16,6 @@ public interface UnitMapperEx {
Long
countsByUnit
(
@Param
(
"name"
)
String
name
);
int
batchDeleteUnitByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/UserBusinessMapperEx.java
0 → 100644
View file @
1a8b4d89
package
com.jsh.erp.datasource.mappers
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
/**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/3/29 15:09
*/
public
interface
UserBusinessMapperEx
{
int
batchDeleteUserBusinessByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
}
src/main/java/com/jsh/erp/service/account/AccountService.java
View file @
1a8b4d89
...
...
@@ -7,6 +7,7 @@ import com.jsh.erp.datasource.mappers.*;
import
com.jsh.erp.datasource.vo.AccountVo4InOutList
;
import
com.jsh.erp.datasource.vo.AccountVo4List
;
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
;
...
...
@@ -45,6 +46,8 @@ public class AccountService {
private
AccountItemMapper
accountItemMapper
;
@Resource
private
LogService
logService
;
@Resource
private
UserService
userService
;
public
Account
getAccount
(
long
id
)
{
return
accountMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -112,7 +115,8 @@ public class AccountService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
AccountExample
example
=
new
AccountExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Account
>
list
=
accountMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -317,5 +321,13 @@ public class AccountService {
example
.
createCriteria
().
andIdEqualTo
(
accountId
);
return
accountMapper
.
updateByExampleSelective
(
account
,
example
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
accountMapperEx
.
batchDeleteAccountByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java
View file @
1a8b4d89
package
com.jsh.erp.service.accountHead
;
import
com.alibaba.fastjson.JSONObject
;
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.datasource.mappers.AccountHeadMapper
;
import
com.jsh.erp.datasource.mappers.AccountHeadMapperEx
;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Service
...
...
@@ -28,6 +35,10 @@ public class AccountHeadService {
@Resource
private
AccountHeadMapperEx
accountHeadMapperEx
;
@Resource
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
AccountHead
getAccountHead
(
long
id
)
{
return
accountHeadMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -87,7 +98,7 @@ public class AccountHeadService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
AccountHeadExample
example
=
new
AccountHeadExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
AccountHead
>
list
=
accountHeadMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -122,5 +133,13 @@ public class AccountHeadService {
}
return
resList
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountHeadByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT_HEAD
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
accountHeadMapperEx
.
batchDeleteAccountHeadByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java
View file @
1a8b4d89
...
...
@@ -5,10 +5,12 @@ import com.alibaba.fastjson.JSONObject;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.AccountItemExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.AccountItemMapper
;
import
com.jsh.erp.datasource.mappers.AccountItemMapperEx
;
import
com.jsh.erp.datasource.vo.AccountItemVo4List
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.ErpInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
...
...
@@ -22,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
...
...
@@ -37,6 +40,8 @@ public class AccountItemService {
private
AccountItemMapperEx
accountItemMapperEx
;
@Resource
private
LogService
logService
;
@Resource
private
UserService
userService
;
public
AccountItem
getAccountItem
(
long
id
)
{
return
accountItemMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -83,7 +88,7 @@ public class AccountItemService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
AccountItemExample
example
=
new
AccountItemExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
AccountItem
>
list
=
accountItemMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -135,10 +140,16 @@ public class AccountItemService {
}
}
if
(
null
!=
deletedJson
)
{
StringBuffer
bf
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
deletedJson
.
size
();
i
++)
{
JSONObject
tempDeletedJson
=
JSONObject
.
parseObject
(
deletedJson
.
getString
(
i
));
this
.
deleteAccountItem
(
tempDeletedJson
.
getLong
(
"Id"
));
bf
.
append
(
tempDeletedJson
.
getLong
(
"Id"
));
if
(
i
<(
deletedJson
.
size
()-
1
)){
bf
.
append
(
","
);
}
}
this
.
batchDeleteAccountItemByIds
(
bf
.
toString
());
}
if
(
null
!=
updatedJson
)
{
for
(
int
i
=
0
;
i
<
updatedJson
.
size
();
i
++)
{
...
...
@@ -168,5 +179,13 @@ public class AccountItemService {
return
null
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountItemByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT_ITEM
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
accountItemMapperEx
.
batchDeleteAccountItemByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/app/AppService.java
View file @
1a8b4d89
package
com.jsh.erp.service.app
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.App
;
import
com.jsh.erp.datasource.entities.AppExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.AppMapper
;
import
com.jsh.erp.datasource.mappers.AppMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
@Service
...
...
@@ -23,6 +30,10 @@ public class AppService {
private
AppMapper
appMapper
;
@Resource
private
AppMapperEx
appMapperEx
;
@Resource
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
List
<
App
>
findDock
(){
AppExample
example
=
new
AppExample
();
...
...
@@ -106,4 +117,13 @@ public class AppService {
List
<
App
>
list
=
appMapper
.
selectByExample
(
example
);
return
list
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAppByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_APP
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
appMapperEx
.
batchDeleteAppByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/depot/DepotService.java
View file @
1a8b4d89
package
com.jsh.erp.service.depot
;
import
com.alibaba.fastjson.JSONObject
;
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.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -26,6 +33,10 @@ public class DepotService {
@Resource
private
DepotMapperEx
depotMapperEx
;
@Resource
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
Depot
getDepot
(
long
id
)
{
return
depotMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -78,7 +89,7 @@ public class DepotService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
Depot
>
list
=
depotMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -102,5 +113,13 @@ public class DepotService {
public
List
<
DepotEx
>
getDepotList
(
Map
<
String
,
Object
>
parameterMap
)
{
return
depotMapperEx
.
getDepotList
(
parameterMap
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepotByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
depotMapperEx
.
batchDeleteDepotByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
1a8b4d89
...
...
@@ -141,7 +141,7 @@ public class DepotHeadService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
DepotHeadExample
example
=
new
DepotHeadExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
DepotHead
>
list
=
depotHeadMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -366,14 +366,14 @@ public class DepotHeadService {
if
(
depotItemList
!=
null
&&
depotItemList
.
size
()>
0
){
for
(
DepotItem
depotItem:
depotItemList
){
//BasicNumber=OperNumber*ratio
serialNumberService
.
cancelSerialNumber
(
depotItem
.
getMaterialid
(),
depotItem
.
getHeaderid
(),
depotItem
.
getBasicnumber
().
intValue
(),
userInfo
);
serialNumberService
.
cancelSerialNumber
(
depotItem
.
getMaterialid
(),
depotItem
.
getHeaderid
(),
(
depotItem
.
getBasicnumber
()
==
null
?
0
:
depotItem
.
getBasicnumber
())
.
intValue
(),
userInfo
);
}
}
}
/**删除单据子表数据*/
depotItemMapperEx
.
d
eleteDepotItemByDepotHeadIds
(
new
Long
[]{
id
});
depotItemMapperEx
.
batchD
eleteDepotItemByDepotHeadIds
(
new
Long
[]{
id
});
/**删除单据主表信息*/
d
eleteDepotHead
(
id
);
batchD
eleteDepotHead
ByIds
(
id
.
toString
()
);
}
/**
* create by: cjl
...
...
@@ -391,8 +391,17 @@ public class DepotHeadService {
if
(
StringUtil
.
isNotEmpty
(
ids
)){
String
[]
headIds
=
ids
.
split
(
","
);
for
(
int
i
=
0
;
i
<
headIds
.
length
;
i
++){
deleteDepotHeadAndDetail
(
new
Long
(
headIds
[
i
]));
deleteDepotHeadAndDetail
(
Long
.
valueOf
(
headIds
[
i
]));
}
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepotHeadByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT_HEAD
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
depotHeadMapperEx
.
batchDeleteDepotHeadByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
1a8b4d89
...
...
@@ -105,7 +105,7 @@ public class DepotItemService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
DepotItemExample
example
=
new
DepotItemExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
DepotItem
>
list
=
depotItemMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -248,6 +248,7 @@ public class DepotItemService {
* 更新的需要判断货源是否充足
* */
if
(
null
!=
deletedJson
)
{
StringBuffer
bf
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
deletedJson
.
size
();
i
++)
{
//首先回收序列号,如果是调拨,不用处理序列号
JSONObject
tempDeletedJson
=
JSONObject
.
parseObject
(
deletedJson
.
getString
(
i
));
...
...
@@ -265,13 +266,18 @@ public class DepotItemService {
continue
;
}
if
(
BusinessConstants
.
ENABLE_SERIAL_NUMBER_ENABLED
.
equals
(
material
.
getEnableserialnumber
())){
serialNumberMapperEx
.
cancelSerialNumber
(
depotItem
.
getMaterialid
(),
depotItem
.
getHeaderid
(),
depotItem
.
getBasicnumber
().
intValue
(),
serialNumberMapperEx
.
cancelSerialNumber
(
depotItem
.
getMaterialid
(),
depotItem
.
getHeaderid
(),
(
depotItem
.
getBasicnumber
()
==
null
?
0
:
depotItem
.
getBasicnumber
())
.
intValue
(),
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
());
}
}
this
.
deleteDepotItem
(
tempDeletedJson
.
getLong
(
"Id"
));
bf
.
append
(
tempDeletedJson
.
getLong
(
"Id"
));
if
(
i
<(
deletedJson
.
size
()-
1
)){
bf
.
append
(
","
);
}
}
this
.
batchDeleteDepotItemByIds
(
bf
.
toString
());
}
if
(
null
!=
insertedJson
)
{
for
(
int
i
=
0
;
i
<
insertedJson
.
size
();
i
++)
{
DepotItem
depotItem
=
new
DepotItem
();
...
...
@@ -363,7 +369,7 @@ public class DepotItemService {
if
(
material
==
null
){
continue
;
}
if
(
getCurrentInStock
(
depotItem
.
getMaterialid
())<
depotItem
.
getBasicnumber
().
intValue
()){
if
(
getCurrentInStock
(
depotItem
.
getMaterialid
())<
(
depotItem
.
getBasicnumber
()
==
null
?
0
:
depotItem
.
getBasicnumber
())
.
intValue
()){
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_STOCK_NOT_ENOUGH_CODE
,
String
.
format
(
ExceptionConstants
.
MATERIAL_STOCK_NOT_ENOUGH_MSG
,
material
==
null
?
""
:
material
.
getName
()));
}
...
...
@@ -401,7 +407,7 @@ public class DepotItemService {
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if
(
BusinessConstants
.
ENABLE_SERIAL_NUMBER_ENABLED
.
equals
(
material
.
getEnableserialnumber
()))
{
serialNumberMapperEx
.
cancelSerialNumber
(
depotItem
.
getMaterialid
(),
depotItem
.
getHeaderid
(),
depotItem
.
getBasicnumber
().
intValue
(),
serialNumberMapperEx
.
cancelSerialNumber
(
depotItem
.
getMaterialid
(),
depotItem
.
getHeaderid
(),
(
depotItem
.
getBasicnumber
()
==
null
?
0
:
depotItem
.
getBasicnumber
())
.
intValue
(),
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
());
}
/**收回序列号的时候释放库存*/
...
...
@@ -486,7 +492,7 @@ public class DepotItemService {
}
/**出库时处理序列号*/
if
(
BusinessConstants
.
DEPOTHEAD_TYPE_OUT
.
equals
(
depotHead
.
getType
())){
if
(
getCurrentInStock
(
depotItem
.
getMaterialid
())<
depotItem
.
getBasicnumber
().
intValue
()){
if
(
getCurrentInStock
(
depotItem
.
getMaterialid
())<
(
depotItem
.
getBasicnumber
()
==
null
?
0
:
depotItem
.
getBasicnumber
())
.
intValue
()){
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_STOCK_NOT_ENOUGH_CODE
,
String
.
format
(
ExceptionConstants
.
MATERIAL_STOCK_NOT_ENOUGH_MSG
,
material
==
null
?
""
:
material
.
getName
()));
}
...
...
@@ -536,5 +542,13 @@ public class DepotItemService {
int
outSum
=
findByTypeAndMaterialId
(
BusinessConstants
.
DEPOTHEAD_TYPE_OUT
,
materialId
);
return
(
inSum
-
outSum
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepotItemByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT_ITEM
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
depotItemMapperEx
.
batchDeleteDepotItemByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/functions/FunctionsService.java
View file @
1a8b4d89
package
com.jsh.erp.service.functions
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Functions
;
import
com.jsh.erp.datasource.entities.FunctionsExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.FunctionsMapper
;
import
com.jsh.erp.datasource.mappers.FunctionsMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
@Service
...
...
@@ -24,6 +31,10 @@ public class FunctionsService {
@Resource
private
FunctionsMapperEx
functionsMapperEx
;
@Resource
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
Functions
getFunctions
(
long
id
)
{
return
functionsMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -70,7 +81,7 @@ public class FunctionsService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
FunctionsExample
example
=
new
FunctionsExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
Functions
>
list
=
functionsMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -99,4 +110,13 @@ public class FunctionsService {
List
<
Functions
>
list
=
functionsMapper
.
selectByExample
(
example
);
return
list
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteFunctionsByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_FUNCTIONS
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
functionsMapperEx
.
batchDeleteFunctionsByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java
View file @
1a8b4d89
package
com.jsh.erp.service.inOutItem
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
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.InOutItemMapper
;
import
com.jsh.erp.datasource.mappers.InOutItemMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
@Service
...
...
@@ -24,6 +31,10 @@ public class InOutItemService {
@Resource
private
InOutItemMapperEx
inOutItemMapperEx
;
@Resource
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
InOutItem
getInOutItem
(
long
id
)
{
return
inOutItemMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -70,7 +81,7 @@ public class InOutItemService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
InOutItemExample
example
=
new
InOutItemExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
InOutItem
>
list
=
inOutItemMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -85,4 +96,13 @@ public class InOutItemService {
example
.
setOrderByClause
(
"id desc"
);
return
inOutItemMapper
.
selectByExample
(
example
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteInOutItemByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_IN_OUT_ITEM
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
inOutItemMapperEx
.
batchDeleteInOutItemByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
1a8b4d89
...
...
@@ -2,13 +2,11 @@ package com.jsh.erp.service.material;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.DepotEx
;
import
com.jsh.erp.datasource.entities.Material
;
import
com.jsh.erp.datasource.entities.MaterialExample
;
import
com.jsh.erp.datasource.entities.MaterialVo4Unit
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.mappers.MaterialMapper
;
import
com.jsh.erp.datasource.mappers.MaterialMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
...
...
@@ -20,10 +18,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
@Service
public
class
MaterialService
{
...
...
@@ -35,6 +30,8 @@ public class MaterialService {
private
MaterialMapperEx
materialMapperEx
;
@Resource
private
LogService
logService
;
@Resource
private
UserService
userService
;
public
Material
getMaterial
(
long
id
)
{
return
materialMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -120,7 +117,7 @@ public class MaterialService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
MaterialExample
example
=
new
MaterialExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
Material
>
list
=
materialMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -211,4 +208,13 @@ public class MaterialService {
public
List
<
Material
>
getMaterialEnableSerialNumberList
(
Map
<
String
,
Object
>
parameterMap
)
{
return
materialMapperEx
.
getMaterialEnableSerialNumberList
(
parameterMap
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterialByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_MATERIAL
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
materialMapperEx
.
batchDeleteMaterialByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java
View file @
1a8b4d89
package
com.jsh.erp.service.materialProperty
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.MaterialProperty
;
import
com.jsh.erp.datasource.entities.MaterialPropertyExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.MaterialPropertyMapper
;
import
com.jsh.erp.datasource.mappers.MaterialPropertyMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
@Service
...
...
@@ -24,6 +31,10 @@ public class MaterialPropertyService {
@Resource
private
MaterialPropertyMapperEx
materialPropertyMapperEx
;
@Resource
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
MaterialProperty
getMaterialProperty
(
long
id
)
{
return
materialPropertyMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -70,4 +81,14 @@ public class MaterialPropertyService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
return
0
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterialPropertyByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_MATERIAL_PROPERTY
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
materialPropertyMapperEx
.
batchDeleteMaterialPropertyByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java
View file @
1a8b4d89
...
...
@@ -5,6 +5,7 @@ import com.jsh.erp.constants.BusinessConstants;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.mappers.OrgaUserRelMapper
;
import
com.jsh.erp.datasource.mappers.OrgaUserRelMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.organization.OrganizationService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
...
...
@@ -34,6 +35,8 @@ public class OrgaUserRelService {
private
OrgaUserRelMapperEx
orgaUserRelMapperEx
;
@Resource
private
UserService
userService
;
@Resource
private
LogService
logService
;
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertOrgaUserRel
(
String
beanJson
,
HttpServletRequest
request
)
{
OrgaUserRel
orgaUserRel
=
JSONObject
.
parseObject
(
beanJson
,
OrgaUserRel
.
class
);
...
...
src/main/java/com/jsh/erp/service/person/PersonService.java
View file @
1a8b4d89
package
com.jsh.erp.service.person
;
import
com.alibaba.fastjson.JSONObject
;
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.datasource.mappers.PersonMapper
;
import
com.jsh.erp.datasource.mappers.PersonMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
@Service
...
...
@@ -24,6 +31,10 @@ public class PersonService {
@Resource
private
PersonMapperEx
personMapperEx
;
@Resource
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
Person
getPerson
(
long
id
)
{
return
personMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -70,7 +81,7 @@ public class PersonService {
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
PersonExample
example
=
new
PersonExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
);
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
)
;
List
<
Person
>
list
=
personMapper
.
selectByExample
(
example
);
return
list
.
size
();
}
...
...
@@ -97,6 +108,13 @@ public class PersonService {
return
personMapper
.
selectByExample
(
example
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeletePersonByIds
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_PERSON
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
personMapperEx
.
batchDeletePersonByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
Prev
1
2
3
4
5
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