Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
5dfd28df
提交
5dfd28df
authored
12月 06, 2021
作者:
zjm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(单位模块): 修改组、区域、库房单位名称可以重复的bug
修改组、区域、库房单位名称可以重复的bug
上级
3aec3368
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
24 行增加
和
0 行删除
+24
-0
AreaExhibitionCache.java
...a/com/tykj/dev/device/user/cache/AreaExhibitionCache.java
+7
-0
GroupDao.java
...n/java/com/tykj/dev/device/user/subject/dao/GroupDao.java
+2
-0
UnitStoreLocationDao.java
...ykj/dev/device/user/subject/dao/UnitStoreLocationDao.java
+3
-0
AreaExhibitionServiceImpl.java
.../user/subject/service/impl/AreaExhibitionServiceImpl.java
+4
-0
GroupServiceImpl.java
...ev/device/user/subject/service/impl/GroupServiceImpl.java
+3
-0
UnitStoreLocationServiceImpl.java
...er/subject/service/impl/UnitStoreLocationServiceImpl.java
+5
-0
没有找到文件。
dev-user/src/main/java/com/tykj/dev/device/user/cache/AreaExhibitionCache.java
浏览文件 @
5dfd28df
...
@@ -76,4 +76,11 @@ public class AreaExhibitionCache {
...
@@ -76,4 +76,11 @@ public class AreaExhibitionCache {
map
.
put
(
2
,
idMap
.
get
(
4
).
getAreaName
());
map
.
put
(
2
,
idMap
.
get
(
4
).
getAreaName
());
return
map
;
return
map
;
}
}
/**
* 根据单位名称查询是否存在
*/
public
boolean
isNotName
(
String
name
){
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
noneMatch
(
areaExhibition
->
areaExhibition
.
getAreaName
().
equals
(
name
));
}
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/dao/GroupDao.java
浏览文件 @
5dfd28df
...
@@ -8,4 +8,6 @@ import java.util.List;
...
@@ -8,4 +8,6 @@ import java.util.List;
public
interface
GroupDao
extends
JpaRepository
<
Groups
,
Integer
>,
JpaSpecificationExecutor
<
Groups
>
{
public
interface
GroupDao
extends
JpaRepository
<
Groups
,
Integer
>,
JpaSpecificationExecutor
<
Groups
>
{
List
<
Groups
>
findAllByType
(
Integer
type
);
List
<
Groups
>
findAllByType
(
Integer
type
);
boolean
existsByName
(
String
name
);
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/dao/UnitStoreLocationDao.java
浏览文件 @
5dfd28df
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
dao
;
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
dao
;
import
com.tykj.dev.device.user.subject.entity.UnitStoreLocation
;
import
com.tykj.dev.device.user.subject.entity.UnitStoreLocation
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
...
@@ -10,4 +11,6 @@ public interface UnitStoreLocationDao extends JpaRepository<UnitStoreLocation, I
...
@@ -10,4 +11,6 @@ public interface UnitStoreLocationDao extends JpaRepository<UnitStoreLocation, I
List
<
UnitStoreLocation
>
findAllByUnitIdAndTypeName
(
Integer
unitId
,
String
typeName
);
List
<
UnitStoreLocation
>
findAllByUnitIdAndTypeName
(
Integer
unitId
,
String
typeName
);
List
<
UnitStoreLocation
>
findAllByIdIn
(
List
<
Integer
>
ids
);
List
<
UnitStoreLocation
>
findAllByIdIn
(
List
<
Integer
>
ids
);
boolean
existsByStoreNameAndUnitId
(
String
name
,
Integer
unitId
);
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/AreaExhibitionServiceImpl.java
浏览文件 @
5dfd28df
...
@@ -8,6 +8,7 @@ import com.tykj.dev.device.user.subject.entity.Units;
...
@@ -8,6 +8,7 @@ import com.tykj.dev.device.user.subject.entity.Units;
import
com.tykj.dev.device.user.subject.service.AreaExhibitionService
;
import
com.tykj.dev.device.user.subject.service.AreaExhibitionService
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.exception.ApiException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Comparator
;
import
java.util.Comparator
;
...
@@ -56,6 +57,9 @@ public class AreaExhibitionServiceImpl implements AreaExhibitionService {
...
@@ -56,6 +57,9 @@ public class AreaExhibitionServiceImpl implements AreaExhibitionService {
@Override
@Override
public
AreaExhibition
save
(
AreaExhibition
areaExhibition
)
{
public
AreaExhibition
save
(
AreaExhibition
areaExhibition
)
{
if
(!
areaExhibitionCache
.
isNotName
(
areaExhibition
.
getAreaName
())){
throw
new
ApiException
(
ResponseEntity
.
status
(
20020
).
body
(
"区域名称重复"
));
}
if
(
areaExhibition
.
getId
()==
null
){
if
(
areaExhibition
.
getId
()==
null
){
areaExhibition
.
setOrders
(
areaExhibitionCache
.
findAll
().
size
()+
1
);
areaExhibition
.
setOrders
(
areaExhibitionCache
.
findAll
().
size
()+
1
);
}
else
{
}
else
{
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/GroupServiceImpl.java
浏览文件 @
5dfd28df
...
@@ -31,6 +31,9 @@ public class GroupServiceImpl implements GroupService {
...
@@ -31,6 +31,9 @@ public class GroupServiceImpl implements GroupService {
UnitsService
unitsService
;
UnitsService
unitsService
;
@Override
@Override
public
void
saveGroup
(
Groups
group
)
{
public
void
saveGroup
(
Groups
group
)
{
if
(
groupDao
.
existsByName
(
group
.
getName
())){
throw
new
ApiException
(
ResponseEntity
.
status
(
20020
).
body
(
"组名称重复"
));
}
StringBuffer
stringBuffer
=
new
StringBuffer
();
StringBuffer
stringBuffer
=
new
StringBuffer
();
group
.
getMembers
().
forEach
(
group
.
getMembers
().
forEach
(
integer
->
stringBuffer
.
append
(
","
).
append
(
integer
)
integer
->
stringBuffer
.
append
(
","
).
append
(
integer
)
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/UnitStoreLocationServiceImpl.java
浏览文件 @
5dfd28df
...
@@ -5,7 +5,9 @@ import com.tykj.dev.device.user.subject.dao.UnitStoreLocationDao;
...
@@ -5,7 +5,9 @@ import com.tykj.dev.device.user.subject.dao.UnitStoreLocationDao;
import
com.tykj.dev.device.user.subject.entity.UnitStoreLocation
;
import
com.tykj.dev.device.user.subject.entity.UnitStoreLocation
;
import
com.tykj.dev.device.user.subject.service.UnitStoreLocationService
;
import
com.tykj.dev.device.user.subject.service.UnitStoreLocationService
;
import
com.tykj.dev.misc.base.BaseEntity
;
import
com.tykj.dev.misc.base.BaseEntity
;
import
com.tykj.dev.misc.exception.ApiException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Comparator
;
import
java.util.Comparator
;
...
@@ -49,6 +51,9 @@ public class UnitStoreLocationServiceImpl implements UnitStoreLocationService {
...
@@ -49,6 +51,9 @@ public class UnitStoreLocationServiceImpl implements UnitStoreLocationService {
@Override
@Override
public
UnitStoreLocation
save
(
UnitStoreLocation
unitStoreLocation
)
{
public
UnitStoreLocation
save
(
UnitStoreLocation
unitStoreLocation
)
{
if
(
unitStoreLocationDao
.
existsByStoreNameAndUnitId
(
unitStoreLocation
.
getStoreName
(),
unitStoreLocation
.
getUnitId
())){
throw
new
ApiException
(
ResponseEntity
.
status
(
20020
).
body
(
"区域名称重复"
));
}
return
unitStoreLocationDao
.
save
(
unitStoreLocation
);
return
unitStoreLocationDao
.
save
(
unitStoreLocation
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论