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
08f2ccdd
Commit
08f2ccdd
authored
Nov 17, 2021
by
季圣华
Browse files
新增客户时给当前用户自动授权
parent
fcdecf25
Changes
3
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/SupplierMapperEx.java
View file @
08f2ccdd
...
@@ -30,4 +30,7 @@ public interface SupplierMapperEx {
...
@@ -30,4 +30,7 @@ public interface SupplierMapperEx {
@Param
(
"telephone"
)
String
telephone
);
@Param
(
"telephone"
)
String
telephone
);
int
batchDeleteSupplierByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
int
batchDeleteSupplierByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
Supplier
getSupplierByName
(
@Param
(
"supplier"
)
String
supplier
);
}
}
\ No newline at end of file
jshERP-boot/src/main/java/com/jsh/erp/service/supplier/SupplierService.java
View file @
08f2ccdd
...
@@ -14,7 +14,9 @@ import com.jsh.erp.exception.JshException;
...
@@ -14,7 +14,9 @@ import com.jsh.erp.exception.JshException;
import
com.jsh.erp.service.accountHead.AccountHeadService
;
import
com.jsh.erp.service.accountHead.AccountHeadService
;
import
com.jsh.erp.service.depotHead.DepotHeadService
;
import
com.jsh.erp.service.depotHead.DepotHeadService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.systemConfig.SystemConfigService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -52,6 +54,10 @@ public class SupplierService {
...
@@ -52,6 +54,10 @@ public class SupplierService {
private
DepotHeadService
depotHeadService
;
private
DepotHeadService
depotHeadService
;
@Resource
@Resource
private
AccountHeadService
accountHeadService
;
private
AccountHeadService
accountHeadService
;
@Resource
private
SystemConfigService
systemConfigService
;
@Resource
private
UserBusinessService
userBusinessService
;
public
Supplier
getSupplier
(
long
id
)
throws
Exception
{
public
Supplier
getSupplier
(
long
id
)
throws
Exception
{
Supplier
result
=
null
;
Supplier
result
=
null
;
...
@@ -139,6 +145,28 @@ public class SupplierService {
...
@@ -139,6 +145,28 @@ public class SupplierService {
try
{
try
{
supplier
.
setEnabled
(
true
);
supplier
.
setEnabled
(
true
);
result
=
supplierMapper
.
insertSelective
(
supplier
);
result
=
supplierMapper
.
insertSelective
(
supplier
);
//新增客户时给当前用户自动授权
if
(
"客户"
.
equals
(
supplier
.
getType
()))
{
Long
userId
=
userService
.
getUserId
(
request
);
Supplier
sInfo
=
supplierMapperEx
.
getSupplierByName
(
supplier
.
getSupplier
());
String
ubKey
=
"["
+
sInfo
.
getId
()
+
"]"
;
List
<
UserBusiness
>
ubList
=
userBusinessService
.
getBasicData
(
userId
.
toString
(),
"UserCustomer"
);
if
(
ubList
==
null
||
ubList
.
size
()
==
0
)
{
JSONObject
ubObj
=
new
JSONObject
();
ubObj
.
put
(
"type"
,
"UserCustomer"
);
ubObj
.
put
(
"keyId"
,
userId
);
ubObj
.
put
(
"value"
,
ubKey
);
userBusinessService
.
insertUserBusiness
(
ubObj
,
request
);
}
else
{
UserBusiness
ubInfo
=
ubList
.
get
(
0
);
JSONObject
ubObj
=
new
JSONObject
();
ubObj
.
put
(
"id"
,
ubInfo
.
getId
());
ubObj
.
put
(
"type"
,
ubInfo
.
getType
());
ubObj
.
put
(
"keyId"
,
ubInfo
.
getKeyId
());
ubObj
.
put
(
"value"
,
ubInfo
.
getValue
()
+
ubKey
);
userBusinessService
.
updateUserBusiness
(
ubObj
,
request
);
}
}
logService
.
insertLog
(
"商家"
,
logService
.
insertLog
(
"商家"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
supplier
.
getSupplier
()).
toString
(),
request
);
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
supplier
.
getSupplier
()).
toString
(),
request
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
...
jshERP-boot/src/main/resources/mapper_xml/SupplierMapperEx.xml
View file @
08f2ccdd
...
@@ -71,6 +71,7 @@
...
@@ -71,6 +71,7 @@
and ifnull(delete_flag,'0') !='1'
and ifnull(delete_flag,'0') !='1'
order by id desc
order by id desc
</select>
</select>
<update
id=
"batchDeleteSupplierByIds"
>
<update
id=
"batchDeleteSupplierByIds"
>
update jsh_supplier
update jsh_supplier
set delete_flag='1'
set delete_flag='1'
...
@@ -81,4 +82,10 @@
...
@@ -81,4 +82,10 @@
</foreach>
</foreach>
)
)
</update>
</update>
<select
id=
"getSupplierByName"
resultType=
"com.jsh.erp.datasource.entities.Supplier"
>
select *
from jsh_supplier
where supplier = #{supplier}
</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