Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
30f097ed
提交
30f097ed
authored
1月 31, 2023
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完善 DictDataServiceImpl 单元测试
上级
6d770bba
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
23 行增加
和
25 行删除
+23
-25
BpmTaskAssignRuleServiceImpl.java
.../bpm/service/definition/BpmTaskAssignRuleServiceImpl.java
+1
-1
DictDataApi.java
.../cn/iocoder/yudao/module/system/api/dict/DictDataApi.java
+2
-2
DictDataApiImpl.java
...iocoder/yudao/module/system/api/dict/DictDataApiImpl.java
+2
-3
DictDataController.java
...dule/system/controller/admin/dict/DictDataController.java
+2
-2
DictDataService.java
...der/yudao/module/system/service/dict/DictDataService.java
+3
-3
DictDataServiceImpl.java
...yudao/module/system/service/dict/DictDataServiceImpl.java
+13
-14
DictDataServiceImplTest.java
...o/module/system/service/dict/DictDataServiceImplTest.java
+0
-0
没有找到文件。
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java
浏览文件 @
30f097ed
...
@@ -224,7 +224,7 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
...
@@ -224,7 +224,7 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
}
else
if
(
Objects
.
equals
(
type
,
BpmTaskAssignRuleTypeEnum
.
USER_GROUP
.
getType
()))
{
}
else
if
(
Objects
.
equals
(
type
,
BpmTaskAssignRuleTypeEnum
.
USER_GROUP
.
getType
()))
{
userGroupService
.
validUserGroups
(
options
);
userGroupService
.
validUserGroups
(
options
);
}
else
if
(
Objects
.
equals
(
type
,
BpmTaskAssignRuleTypeEnum
.
SCRIPT
.
getType
()))
{
}
else
if
(
Objects
.
equals
(
type
,
BpmTaskAssignRuleTypeEnum
.
SCRIPT
.
getType
()))
{
dictDataApi
.
validDictDatas
(
DictTypeConstants
.
TASK_ASSIGN_SCRIPT
,
dictDataApi
.
valid
ate
DictDatas
(
DictTypeConstants
.
TASK_ASSIGN_SCRIPT
,
CollectionUtils
.
convertSet
(
options
,
String:
:
valueOf
));
CollectionUtils
.
convertSet
(
options
,
String:
:
valueOf
));
}
else
{
}
else
{
throw
new
IllegalArgumentException
(
format
(
"未知的规则类型({})"
,
type
));
throw
new
IllegalArgumentException
(
format
(
"未知的规则类型({})"
,
type
));
...
...
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java
浏览文件 @
30f097ed
...
@@ -25,8 +25,8 @@ public interface DictDataApi {
...
@@ -25,8 +25,8 @@ public interface DictDataApi {
@ApiImplicitParam
(
name
=
"dictType"
,
value
=
"字典类型"
,
example
=
"SEX"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@ApiImplicitParam
(
name
=
"dictType"
,
value
=
"字典类型"
,
example
=
"SEX"
,
required
=
true
,
dataTypeClass
=
String
.
class
),
@ApiImplicitParam
(
name
=
"values"
,
value
=
"字典数据值的数组"
,
example
=
"1,2"
,
required
=
true
,
allowMultiple
=
true
)
@ApiImplicitParam
(
name
=
"values"
,
value
=
"字典数据值的数组"
,
example
=
"1,2"
,
required
=
true
,
allowMultiple
=
true
)
})
})
CommonResult
<
Boolean
>
validDictDatas
(
@RequestParam
(
"dictType"
)
String
dictType
,
CommonResult
<
Boolean
>
valid
ate
DictDatas
(
@RequestParam
(
"dictType"
)
String
dictType
,
@RequestParam
(
"values"
)
Collection
<
String
>
values
);
@RequestParam
(
"values"
)
Collection
<
String
>
values
);
@GetMapping
(
PREFIX
+
"/get"
)
@GetMapping
(
PREFIX
+
"/get"
)
@ApiOperation
(
"获得指定的字典数据"
)
@ApiOperation
(
"获得指定的字典数据"
)
...
...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java
浏览文件 @
30f097ed
...
@@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.convert.dict.DictDataConvert;
...
@@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.convert.dict.DictDataConvert;
import
cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO
;
import
cn.iocoder.yudao.module.system.service.dict.DictDataService
;
import
cn.iocoder.yudao.module.system.service.dict.DictDataService
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -25,8 +24,8 @@ public class DictDataApiImpl implements DictDataApi {
...
@@ -25,8 +24,8 @@ public class DictDataApiImpl implements DictDataApi {
private
DictDataService
dictDataService
;
private
DictDataService
dictDataService
;
@Override
@Override
public
CommonResult
<
Boolean
>
validDictDatas
(
String
dictType
,
Collection
<
String
>
values
)
{
public
CommonResult
<
Boolean
>
valid
ate
DictDatas
(
String
dictType
,
Collection
<
String
>
values
)
{
dictDataService
.
valid
DictDatas
(
dictType
,
values
);
dictDataService
.
valid
ateDictDataList
(
dictType
,
values
);
return
success
(
true
);
return
success
(
true
);
}
}
...
...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java
浏览文件 @
30f097ed
...
@@ -62,7 +62,7 @@ public class DictDataController {
...
@@ -62,7 +62,7 @@ public class DictDataController {
@ApiOperation
(
value
=
"获得全部字典数据列表"
,
notes
=
"一般用于管理后台缓存字典数据在本地"
)
@ApiOperation
(
value
=
"获得全部字典数据列表"
,
notes
=
"一般用于管理后台缓存字典数据在本地"
)
// 无需添加权限认证,因为前端全局都需要
// 无需添加权限认证,因为前端全局都需要
public
CommonResult
<
List
<
DictDataSimpleRespVO
>>
getSimpleDictDatas
()
{
public
CommonResult
<
List
<
DictDataSimpleRespVO
>>
getSimpleDictDatas
()
{
List
<
DictDataDO
>
list
=
dictDataService
.
getDictData
s
();
List
<
DictDataDO
>
list
=
dictDataService
.
getDictData
List
();
return
success
(
DictDataConvert
.
INSTANCE
.
convertList
(
list
));
return
success
(
DictDataConvert
.
INSTANCE
.
convertList
(
list
));
}
}
...
@@ -86,7 +86,7 @@ public class DictDataController {
...
@@ -86,7 +86,7 @@ public class DictDataController {
@PreAuthorize
(
"@ss.hasPermission('system:dict:export')"
)
@PreAuthorize
(
"@ss.hasPermission('system:dict:export')"
)
@OperateLog
(
type
=
EXPORT
)
@OperateLog
(
type
=
EXPORT
)
public
void
export
(
HttpServletResponse
response
,
@Valid
DictDataExportReqVO
reqVO
)
throws
IOException
{
public
void
export
(
HttpServletResponse
response
,
@Valid
DictDataExportReqVO
reqVO
)
throws
IOException
{
List
<
DictDataDO
>
list
=
dictDataService
.
getDictData
s
(
reqVO
);
List
<
DictDataDO
>
list
=
dictDataService
.
getDictData
List
(
reqVO
);
List
<
DictDataExcelVO
>
data
=
DictDataConvert
.
INSTANCE
.
convertList02
(
list
);
List
<
DictDataExcelVO
>
data
=
DictDataConvert
.
INSTANCE
.
convertList02
(
list
);
// 输出
// 输出
ExcelUtils
.
write
(
response
,
"字典数据.xls"
,
"数据列表"
,
DictDataExcelVO
.
class
,
data
);
ExcelUtils
.
write
(
response
,
"字典数据.xls"
,
"数据列表"
,
DictDataExcelVO
.
class
,
data
);
...
...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java
浏览文件 @
30f097ed
...
@@ -44,7 +44,7 @@ public interface DictDataService {
...
@@ -44,7 +44,7 @@ public interface DictDataService {
*
*
* @return 字典数据全列表
* @return 字典数据全列表
*/
*/
List
<
DictDataDO
>
getDictData
s
();
List
<
DictDataDO
>
getDictData
List
();
/**
/**
* 获得字典数据分页列表
* 获得字典数据分页列表
...
@@ -60,7 +60,7 @@ public interface DictDataService {
...
@@ -60,7 +60,7 @@ public interface DictDataService {
* @param reqVO 列表请求
* @param reqVO 列表请求
* @return 字典数据列表
* @return 字典数据列表
*/
*/
List
<
DictDataDO
>
getDictData
s
(
DictDataExportReqVO
reqVO
);
List
<
DictDataDO
>
getDictData
List
(
DictDataExportReqVO
reqVO
);
/**
/**
* 获得字典数据详情
* 获得字典数据详情
...
@@ -86,7 +86,7 @@ public interface DictDataService {
...
@@ -86,7 +86,7 @@ public interface DictDataService {
* @param dictType 字典类型
* @param dictType 字典类型
* @param values 字典数据值的数组
* @param values 字典数据值的数组
*/
*/
void
valid
DictDatas
(
String
dictType
,
Collection
<
String
>
values
);
void
valid
ateDictDataList
(
String
dictType
,
Collection
<
String
>
values
);
/**
/**
* 获得指定的字典数据
* 获得指定的字典数据
...
...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java
浏览文件 @
30f097ed
...
@@ -48,7 +48,7 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -48,7 +48,7 @@ public class DictDataServiceImpl implements DictDataService {
private
DictDataMapper
dictDataMapper
;
private
DictDataMapper
dictDataMapper
;
@Override
@Override
public
List
<
DictDataDO
>
getDictData
s
()
{
public
List
<
DictDataDO
>
getDictData
List
()
{
List
<
DictDataDO
>
list
=
dictDataMapper
.
selectList
();
List
<
DictDataDO
>
list
=
dictDataMapper
.
selectList
();
list
.
sort
(
COMPARATOR_TYPE_AND_SORT
);
list
.
sort
(
COMPARATOR_TYPE_AND_SORT
);
return
list
;
return
list
;
...
@@ -60,7 +60,7 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -60,7 +60,7 @@ public class DictDataServiceImpl implements DictDataService {
}
}
@Override
@Override
public
List
<
DictDataDO
>
getDictData
s
(
DictDataExportReqVO
reqVO
)
{
public
List
<
DictDataDO
>
getDictData
List
(
DictDataExportReqVO
reqVO
)
{
List
<
DictDataDO
>
list
=
dictDataMapper
.
selectList
(
reqVO
);
List
<
DictDataDO
>
list
=
dictDataMapper
.
selectList
(
reqVO
);
list
.
sort
(
COMPARATOR_TYPE_AND_SORT
);
list
.
sort
(
COMPARATOR_TYPE_AND_SORT
);
return
list
;
return
list
;
...
@@ -74,7 +74,7 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -74,7 +74,7 @@ public class DictDataServiceImpl implements DictDataService {
@Override
@Override
public
Long
createDictData
(
DictDataCreateReqVO
reqVO
)
{
public
Long
createDictData
(
DictDataCreateReqVO
reqVO
)
{
// 校验正确性
// 校验正确性
check
CreateOrUpdate
(
null
,
reqVO
.
getValue
(),
reqVO
.
getDictType
());
validateDictDataFor
CreateOrUpdate
(
null
,
reqVO
.
getValue
(),
reqVO
.
getDictType
());
// 插入字典类型
// 插入字典类型
DictDataDO
dictData
=
DictDataConvert
.
INSTANCE
.
convert
(
reqVO
);
DictDataDO
dictData
=
DictDataConvert
.
INSTANCE
.
convert
(
reqVO
);
...
@@ -85,7 +85,7 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -85,7 +85,7 @@ public class DictDataServiceImpl implements DictDataService {
@Override
@Override
public
void
updateDictData
(
DictDataUpdateReqVO
reqVO
)
{
public
void
updateDictData
(
DictDataUpdateReqVO
reqVO
)
{
// 校验正确性
// 校验正确性
check
CreateOrUpdate
(
reqVO
.
getId
(),
reqVO
.
getValue
(),
reqVO
.
getDictType
());
validateDictDataFor
CreateOrUpdate
(
reqVO
.
getId
(),
reqVO
.
getValue
(),
reqVO
.
getDictType
());
// 更新字典类型
// 更新字典类型
DictDataDO
updateObj
=
DictDataConvert
.
INSTANCE
.
convert
(
reqVO
);
DictDataDO
updateObj
=
DictDataConvert
.
INSTANCE
.
convert
(
reqVO
);
...
@@ -95,7 +95,7 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -95,7 +95,7 @@ public class DictDataServiceImpl implements DictDataService {
@Override
@Override
public
void
deleteDictData
(
Long
id
)
{
public
void
deleteDictData
(
Long
id
)
{
// 校验是否存在
// 校验是否存在
check
DictDataExists
(
id
);
validate
DictDataExists
(
id
);
// 删除字典数据
// 删除字典数据
dictDataMapper
.
deleteById
(
id
);
dictDataMapper
.
deleteById
(
id
);
...
@@ -106,18 +106,17 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -106,18 +106,17 @@ public class DictDataServiceImpl implements DictDataService {
return
dictDataMapper
.
selectCountByDictType
(
dictType
);
return
dictDataMapper
.
selectCountByDictType
(
dictType
);
}
}
private
void
validateDictDataForCreateOrUpdate
(
Long
id
,
String
value
,
String
dictType
)
{
private
void
checkCreateOrUpdate
(
Long
id
,
String
value
,
String
dictType
)
{
// 校验自己存在
// 校验自己存在
check
DictDataExists
(
id
);
validate
DictDataExists
(
id
);
// 校验字典类型有效
// 校验字典类型有效
checkDictTypeValid
(
dictType
);
validateDictTypeExists
(
dictType
);
// 校验字典数据的值的唯一性
// 校验字典数据的值的唯一性
check
DictDataValueUnique
(
id
,
dictType
,
value
);
validate
DictDataValueUnique
(
id
,
dictType
,
value
);
}
}
@VisibleForTesting
@VisibleForTesting
public
void
check
DictDataValueUnique
(
Long
id
,
String
dictType
,
String
value
)
{
public
void
validate
DictDataValueUnique
(
Long
id
,
String
dictType
,
String
value
)
{
DictDataDO
dictData
=
dictDataMapper
.
selectByDictTypeAndValue
(
dictType
,
value
);
DictDataDO
dictData
=
dictDataMapper
.
selectByDictTypeAndValue
(
dictType
,
value
);
if
(
dictData
==
null
)
{
if
(
dictData
==
null
)
{
return
;
return
;
...
@@ -132,7 +131,7 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -132,7 +131,7 @@ public class DictDataServiceImpl implements DictDataService {
}
}
@VisibleForTesting
@VisibleForTesting
public
void
check
DictDataExists
(
Long
id
)
{
public
void
validate
DictDataExists
(
Long
id
)
{
if
(
id
==
null
)
{
if
(
id
==
null
)
{
return
;
return
;
}
}
...
@@ -143,7 +142,7 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -143,7 +142,7 @@ public class DictDataServiceImpl implements DictDataService {
}
}
@VisibleForTesting
@VisibleForTesting
public
void
checkDictTypeValid
(
String
type
)
{
public
void
validateDictTypeExists
(
String
type
)
{
DictTypeDO
dictType
=
dictTypeService
.
getDictType
(
type
);
DictTypeDO
dictType
=
dictTypeService
.
getDictType
(
type
);
if
(
dictType
==
null
)
{
if
(
dictType
==
null
)
{
throw
exception
(
DICT_TYPE_NOT_EXISTS
);
throw
exception
(
DICT_TYPE_NOT_EXISTS
);
...
@@ -154,7 +153,7 @@ public class DictDataServiceImpl implements DictDataService {
...
@@ -154,7 +153,7 @@ public class DictDataServiceImpl implements DictDataService {
}
}
@Override
@Override
public
void
valid
DictDatas
(
String
dictType
,
Collection
<
String
>
values
)
{
public
void
valid
ateDictDataList
(
String
dictType
,
Collection
<
String
>
values
)
{
if
(
CollUtil
.
isEmpty
(
values
))
{
if
(
CollUtil
.
isEmpty
(
values
))
{
return
;
return
;
}
}
...
...
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceTest.java
→
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataService
Impl
Test.java
浏览文件 @
30f097ed
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论