Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
ae76ad66
提交
ae76ad66
authored
10月 26, 2020
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 增加了核查的手动与自动的字段区分
上级
2c924d95
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
146 行增加
和
10 行删除
+146
-10
CheckType.java
...va/com/tykj/dev/device/confirmcheck/common/CheckType.java
+28
-0
CheckTypeConvert.java
...tykj/dev/device/confirmcheck/common/CheckTypeConvert.java
+55
-0
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+11
-6
DeviceCheckStat.java
...ev/device/confirmcheck/entity/domain/DeviceCheckStat.java
+12
-2
CheckStatVo.java
...m/tykj/dev/device/confirmcheck/entity/vo/CheckStatVo.java
+4
-0
MapperHelper.java
.../com/tykj/dev/device/confirmcheck/utils/MapperHelper.java
+34
-0
ObjTransUtil.java
.../com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
+1
-1
DeviceCheckControllerTest.java
.../com/tykj/dev/confirmcheck/DeviceCheckControllerTest.java
+1
-1
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/common/CheckType.java
0 → 100644
浏览文件 @
ae76ad66
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
common
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* CheckType.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2020/10/26 at 2:29 下午
*/
@Getter
@AllArgsConstructor
public
enum
CheckType
{
/**
* 自动核查
*/
AUTO_CHECK
(
1
,
"自动核查"
),
/**
* 手动核查
*/
MANUAL_CHECK
(
2
,
"手动核查"
);
private
Integer
id
;
private
String
name
;
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/common/CheckTypeConvert.java
0 → 100644
浏览文件 @
ae76ad66
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
common
;
import
javax.persistence.AttributeConverter
;
import
javax.persistence.Converter
;
import
java.util.stream.Stream
;
/**
* CheckTypeConvert.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2020/10/26 at 2:36 下午
*/
@Converter
(
autoApply
=
true
)
public
class
CheckTypeConvert
implements
AttributeConverter
<
CheckType
,
Integer
>
{
/**
* Converts the value stored in the entity attribute into the
* data representation to be stored in the database.
*
* @param attribute the entity attribute value to be converted
* @return the converted data to be stored in the database
* column
*/
@Override
public
Integer
convertToDatabaseColumn
(
CheckType
attribute
)
{
if
(
attribute
==
null
)
{
return
null
;
}
return
attribute
.
getId
();
}
/**
* Converts the data stored in the database column into the
* value to be stored in the entity attribute.
* Note that it is the responsibility of the converter writer to
* specify the correct <code>dbData</code> type for the corresponding
* column for use by the JDBC driver: i.e., persistence providers are
* not expected to do such type conversion.
*
* @param dbData the data from the database column to be
* converted
* @return the converted value to be stored in the entity
* attribute
*/
@Override
public
CheckType
convertToEntityAttribute
(
Integer
dbData
)
{
if
(
dbData
==
null
)
{
return
null
;
}
return
Stream
.
of
(
CheckType
.
values
())
.
filter
(
t
->
t
.
getId
().
equals
(
dbData
))
.
findFirst
()
.
orElseThrow
(
IllegalArgumentException:
:
new
);
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
ae76ad66
...
@@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableMap;
...
@@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableMap;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.tykj.dev.config.GlobalMap
;
import
com.tykj.dev.config.GlobalMap
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.confirmcheck.
service.ConfirmCheckServic
e
;
import
com.tykj.dev.device.confirmcheck.
common.CheckTyp
e
;
import
com.tykj.dev.device.confirmcheck.entity.cache.AreaCache
;
import
com.tykj.dev.device.confirmcheck.entity.cache.AreaCache
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBill
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBill
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
...
@@ -13,6 +13,7 @@ import com.tykj.dev.device.confirmcheck.entity.vo.*;
...
@@ -13,6 +13,7 @@ import com.tykj.dev.device.confirmcheck.entity.vo.*;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckBillDao
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckBillDao
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatRepo
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatRepo
;
import
com.tykj.dev.device.confirmcheck.service.ConfirmCheckService
;
import
com.tykj.dev.device.confirmcheck.utils.ObjTransUtil
;
import
com.tykj.dev.device.confirmcheck.utils.ObjTransUtil
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
...
@@ -99,12 +100,12 @@ public class DeviceCheckController {
...
@@ -99,12 +100,12 @@ public class DeviceCheckController {
@ApiOperation
(
value
=
"根据id查询核查统计数据"
,
notes
=
"可以通过这个接口查询核查统计数据"
)
@ApiOperation
(
value
=
"根据id查询核查统计数据"
,
notes
=
"可以通过这个接口查询核查统计数据"
)
@GetMapping
(
"/stat/{id}"
)
@GetMapping
(
"/stat/{id}"
)
public
ResponseEntity
<
ResultObj
<
CheckStatVo
>>
findStatById
(
@PathVariable
Integer
id
)
{
public
CheckStatVo
findStatById
(
@PathVariable
Integer
id
)
{
//还要查询出所有的
//还要查询出所有的
CheckStatVo
statVoList
=
statRepo
.
findById
(
id
)
CheckStatVo
statVoList
=
statRepo
.
findById
(
id
)
.
map
(
transUtil:
:
checkStatDo2Vo
)
.
map
(
transUtil:
:
checkStatDo2Vo
)
.
orElse
(
CheckStatVo
.
empty
());
.
orElse
(
CheckStatVo
.
empty
());
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
statVoList
))
;
return
statVoList
;
}
}
...
@@ -129,7 +130,7 @@ public class DeviceCheckController {
...
@@ -129,7 +130,7 @@ public class DeviceCheckController {
@ApiOperation
(
value
=
"发起自动核查"
,
notes
=
"发起自动核查"
)
@ApiOperation
(
value
=
"发起自动核查"
,
notes
=
"发起自动核查"
)
@PostMapping
(
"/auto"
)
@PostMapping
(
"/auto"
)
public
Res
ponseEntity
<
ResultObj
<
Map
<
String
,
List
<
Integer
>
>>>
startAutoCheck
()
{
public
Res
ultObj
<
Map
<
String
,
List
<
Integer
>>>
startAutoCheck
()
{
// 构建返回数据对象
// 构建返回数据对象
Map
<
String
,
List
<
Integer
>>
resultIds
=
new
HashMap
<>(
8
);
Map
<
String
,
List
<
Integer
>>
resultIds
=
new
HashMap
<>(
8
);
resultIds
.
put
(
"statId"
,
new
ArrayList
<>());
resultIds
.
put
(
"statId"
,
new
ArrayList
<>());
...
@@ -145,6 +146,7 @@ public class DeviceCheckController {
...
@@ -145,6 +146,7 @@ public class DeviceCheckController {
// 构建省的统计账单
// 构建省的统计账单
DeviceCheckStat
provStatDo
=
new
DeviceCheckStat
(
DeviceCheckStat
provStatDo
=
new
DeviceCheckStat
(
CheckType
.
AUTO_CHECK
,
baseTitle
+
provUnit
.
getName
()
+
"核查统计单"
,
baseTitle
+
provUnit
.
getName
()
+
"核查统计单"
,
"核查统计单"
,
"核查统计单"
,
"系统发起的统计|"
+
provUnit
.
getName
()
+
"|"
+
provUnit
.
getAreaId
());
"系统发起的统计|"
+
provUnit
.
getName
()
+
"|"
+
provUnit
.
getAreaId
());
...
@@ -177,6 +179,7 @@ public class DeviceCheckController {
...
@@ -177,6 +179,7 @@ public class DeviceCheckController {
// 构建市统账单
// 构建市统账单
DeviceCheckStat
cityStatDo
=
new
DeviceCheckStat
(
DeviceCheckStat
cityStatDo
=
new
DeviceCheckStat
(
CheckType
.
AUTO_CHECK
,
baseTitle
+
cityUnit
.
getName
()
+
"核查统计单"
,
baseTitle
+
cityUnit
.
getName
()
+
"核查统计单"
,
"核查统计单"
,
"核查统计单"
,
"系统发起的统计|"
+
cityUnit
.
getName
()
+
"|"
+
cityUnit
.
getAreaId
()
"系统发起的统计|"
+
cityUnit
.
getName
()
+
"|"
+
cityUnit
.
getAreaId
()
...
@@ -300,7 +303,7 @@ public class DeviceCheckController {
...
@@ -300,7 +303,7 @@ public class DeviceCheckController {
statRepo
.
saveAll
(
cityStatList
);
statRepo
.
saveAll
(
cityStatList
);
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
resultIds
,
"自动核查任务发起成功"
)
);
return
new
ResultObj
<>(
resultIds
,
"自动核查任务发起成功"
);
}
}
/**
/**
...
@@ -701,7 +704,9 @@ public class DeviceCheckController {
...
@@ -701,7 +704,9 @@ public class DeviceCheckController {
.
collect
(
toMap
(
CheckDeviceStatVo:
:
getDeviceModel
,
Function
.
identity
(),
CheckDeviceStatVo:
:
reduce
))
.
collect
(
toMap
(
CheckDeviceStatVo:
:
getDeviceModel
,
Function
.
identity
(),
CheckDeviceStatVo:
:
reduce
))
.
values
();
.
values
();
return
new
DeviceCheckStat
(
title
,
return
new
DeviceCheckStat
(
CheckType
.
MANUAL_CHECK
,
title
,
startUnitName
+
"待核查装备统计单"
,
startUnitName
+
"待核查装备统计单"
,
JacksonUtil
.
toJSon
(
new
ArrayList
<>(
statVos
)),
JacksonUtil
.
toJSon
(
new
ArrayList
<>(
statVos
)),
checkAId
,
checkAId
,
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/domain/DeviceCheckStat.java
浏览文件 @
ae76ad66
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
domain
;
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
domain
;
import
com.tykj.dev.device.confirmcheck.common.CheckType
;
import
com.tykj.dev.misc.base.BaseEntity
;
import
com.tykj.dev.misc.base.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -53,6 +54,13 @@ public class DeviceCheckStat extends BaseEntity {
...
@@ -53,6 +54,13 @@ public class DeviceCheckStat extends BaseEntity {
*/
*/
private
String
statInfo
;
private
String
statInfo
;
/**
* 检查类型,数据库里的数据结构是int类型,其中1为自动,2为手动
*
* @see com.tykj.dev.device.confirmcheck.common.CheckTypeConvert
*/
private
CheckType
checkType
;
/**
/**
* 检查组成员A
* 检查组成员A
*/
*/
...
@@ -89,7 +97,8 @@ public class DeviceCheckStat extends BaseEntity {
...
@@ -89,7 +97,8 @@ public class DeviceCheckStat extends BaseEntity {
this
.
remark
=
remark
;
this
.
remark
=
remark
;
}
}
public
DeviceCheckStat
(
String
title
,
String
subtitle
,
String
statInfo
,
Integer
checkUserAId
,
Integer
checkUserBId
,
String
remark
)
{
public
DeviceCheckStat
(
CheckType
checkType
,
String
title
,
String
subtitle
,
String
statInfo
,
Integer
checkUserAId
,
Integer
checkUserBId
,
String
remark
)
{
this
.
checkType
=
checkType
;
this
.
title
=
title
;
this
.
title
=
title
;
this
.
subtitle
=
subtitle
;
this
.
subtitle
=
subtitle
;
this
.
startTime
=
LocalDateTime
.
now
();
this
.
startTime
=
LocalDateTime
.
now
();
...
@@ -100,7 +109,8 @@ public class DeviceCheckStat extends BaseEntity {
...
@@ -100,7 +109,8 @@ public class DeviceCheckStat extends BaseEntity {
this
.
remark
=
remark
;
this
.
remark
=
remark
;
}
}
public
DeviceCheckStat
(
String
title
,
String
subtitle
,
String
remark
)
{
public
DeviceCheckStat
(
CheckType
checkType
,
String
title
,
String
subtitle
,
String
remark
)
{
this
.
checkType
=
checkType
;
this
.
title
=
title
;
this
.
title
=
title
;
this
.
subtitle
=
subtitle
;
this
.
subtitle
=
subtitle
;
this
.
startTime
=
LocalDateTime
.
now
();
this
.
startTime
=
LocalDateTime
.
now
();
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckStatVo.java
浏览文件 @
ae76ad66
...
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
...
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
...
@@ -63,6 +64,9 @@ public class CheckStatVo {
...
@@ -63,6 +64,9 @@ public class CheckStatVo {
private
LocalDateTime
updateTime
;
private
LocalDateTime
updateTime
;
@ApiModelProperty
(
name
=
"检查类型(0异常,1自动,2手动)"
)
private
Integer
checkType
;
private
Integer
createUserId
;
private
Integer
createUserId
;
private
Integer
updateUserId
;
private
Integer
updateUserId
;
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/utils/MapperHelper.java
0 → 100644
浏览文件 @
ae76ad66
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
utils
;
import
com.tykj.dev.device.confirmcheck.common.CheckType
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.device.confirmcheck.entity.vo.CheckStatVo
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
lombok.Getter
;
import
org.modelmapper.Converter
;
import
org.modelmapper.ModelMapper
;
/**
* MapperHelper.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2020/10/26 at 2:50 下午
*/
public
class
MapperHelper
{
private
static
ModelMapper
mapper
=
BeanHelper
.
getUserMapper
();
static
{
Converter
<
CheckType
,
Integer
>
checkTypeConverter
=
ctx
->
ctx
.
getSource
()
==
null
?
0
:
ctx
.
getSource
().
getId
();
mapper
.
typeMap
(
DeviceCheckStat
.
class
,
CheckStatVo
.
class
)
.
addMappings
(
mapping
->
mapping
.
using
(
checkTypeConverter
)
.
map
(
DeviceCheckStat:
:
getCheckType
,
CheckStatVo:
:
setCheckType
));
}
public
static
ModelMapper
getMapper
()
{
return
mapper
;
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
浏览文件 @
ae76ad66
...
@@ -152,7 +152,7 @@ public class ObjTransUtil {
...
@@ -152,7 +152,7 @@ public class ObjTransUtil {
* Do类转化为Vo类
* Do类转化为Vo类
*/
*/
public
CheckStatVo
checkStatDo2Vo
(
DeviceCheckStat
statDo
)
{
public
CheckStatVo
checkStatDo2Vo
(
DeviceCheckStat
statDo
)
{
ModelMapper
mapper
=
BeanHelper
.
getUser
Mapper
();
ModelMapper
mapper
=
MapperHelper
.
get
Mapper
();
//复制基本信息
//复制基本信息
CheckStatVo
initialStat
=
mapper
.
map
(
statDo
,
CheckStatVo
.
class
);
CheckStatVo
initialStat
=
mapper
.
map
(
statDo
,
CheckStatVo
.
class
);
// 查询userAName 与 userBName
// 查询userAName 与 userBName
...
...
dev-union/src/test/java/com/tykj/dev/confirmcheck/DeviceCheckControllerTest.java
浏览文件 @
ae76ad66
...
@@ -101,7 +101,7 @@ class DeviceCheckControllerTest extends BaseTest {
...
@@ -101,7 +101,7 @@ class DeviceCheckControllerTest extends BaseTest {
.
map
(
JsonNode:
:
asInt
)
.
map
(
JsonNode:
:
asInt
)
.
forEach
(
statId
->
{
.
forEach
(
statId
->
{
//测试访问
//测试访问
CheckStatVo
statRes
=
checkController
.
findStatById
(
statId
)
.
getBody
().
getData
()
;
CheckStatVo
statRes
=
checkController
.
findStatById
(
statId
);
try
{
try
{
System
.
out
.
println
(
objectMapper
.
writeValueAsString
(
statRes
));
System
.
out
.
println
(
objectMapper
.
writeValueAsString
(
statRes
));
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论