Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
b99865e2
提交
b99865e2
authored
9月 22, 2020
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 修复了一些自动核查相关的BUG
[测试模块] 增加了出现异常后的自动回滚
上级
992e22e5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
40 行增加
和
2 行删除
+40
-2
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+0
-0
DeviceCheckDetailDao.java
.../device/confirmcheck/repository/DeviceCheckDetailDao.java
+1
-1
DeviceCheckControllerTest.java
.../com/tykj/dev/confirmcheck/DeviceCheckControllerTest.java
+37
-1
BaseTest.java
dev-union/src/test/java/com/tykj/dev/union/BaseTest.java
+2
-0
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
b99865e2
差异被折叠。
点击展开。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/repository/DeviceCheckDetailDao.java
浏览文件 @
b99865e2
...
@@ -21,7 +21,7 @@ public interface DeviceCheckDetailDao extends JpaRepository<DeviceCheckDetailEnt
...
@@ -21,7 +21,7 @@ public interface DeviceCheckDetailDao extends JpaRepository<DeviceCheckDetailEnt
*/
*/
@Modifying
@Modifying
@Query
(
"update DeviceCheckDetailEntity o set o.checkDetail=?2,o.checkResult = ?3,o.userAId =?4,o.userBId=?5,o.checkedCount=?6 where o.id=?1"
)
@Query
(
"update DeviceCheckDetailEntity o set o.checkDetail=?2,o.checkResult = ?3,o.userAId =?4,o.userBId=?5,o.checkedCount=?6 where o.id=?1"
)
void
updateCheckDetail
(
Integer
id
,
String
checkDetail
,
String
checkResult
,
int
userAId
,
int
userBId
,
long
checkedCount
);
void
updateCheckDetail
(
Integer
id
,
String
checkDetail
,
String
checkResult
,
int
userAId
,
int
userBId
,
Integer
checkedCount
);
@Modifying
@Modifying
@Query
(
"update DeviceCheckDetailEntity o set o.checkStatus=?2 where o.id=?1"
)
@Query
(
"update DeviceCheckDetailEntity o set o.checkStatus=?2 where o.id=?1"
)
...
...
dev-union/src/test/java/com/tykj/dev/confirmcheck/DeviceCheckControllerTest.java
浏览文件 @
b99865e2
package
com
.
tykj
.
dev
.
confirmcheck
;
package
com
.
tykj
.
dev
.
confirmcheck
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.github.wenhao.jpa.Specifications
;
import
com.github.wenhao.jpa.Specifications
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.tykj.dev.device.confirmcheck.entity.vo.CheckBillVo
;
import
com.tykj.dev.device.confirmcheck.entity.vo.CheckBillVo
;
...
@@ -20,9 +22,11 @@ import org.springframework.test.context.ActiveProfiles;
...
@@ -20,9 +22,11 @@ import org.springframework.test.context.ActiveProfiles;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.RequestBuilder
;
import
org.springframework.test.web.servlet.RequestBuilder
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.StringJoiner
;
import
java.util.StringJoiner
;
import
java.util.stream.StreamSupport
;
import
static
com
.
tykj
.
dev
.
misc
.
utils
.
JacksonUtil
.
toJSon
;
import
static
com
.
tykj
.
dev
.
misc
.
utils
.
JacksonUtil
.
toJSon
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
...
@@ -63,9 +67,41 @@ class DeviceCheckControllerTest extends BaseTest {
...
@@ -63,9 +67,41 @@ class DeviceCheckControllerTest extends BaseTest {
request
=
post
(
"/check/confirm/check/auto"
)
request
=
post
(
"/check/confirm/check/auto"
)
.
header
(
"Origin"
,
"*"
);
.
header
(
"Origin"
,
"*"
);
mockMvc
.
perform
(
request
)
mockMvc
.
perform
(
request
)
.
andExpect
(
status
().
isOk
())
.
andExpect
(
status
().
isOk
())
.
andDo
(
mvcResult1
->
System
.
out
.
println
(
"[测试结果] 自动发起核查任务测试通过"
));
.
andDo
(
result
->
{
String
resultString
=
result
.
getResponse
().
getContentAsString
();
System
.
out
.
println
(
"[测试结果] 自动发起核查任务测试通过,返回结果为 : "
+
resultString
);
deleteAutoCheckData
(
resultString
);
});
}
private
void
deleteAutoCheckData
(
String
resultString
)
throws
IOException
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
JsonNode
jsonNode
=
objectMapper
.
readTree
(
resultString
);
StreamSupport
.
stream
(
jsonNode
.
get
(
"data"
).
get
(
"statId"
).
spliterator
(),
false
)
.
map
(
JsonNode:
:
asInt
)
.
forEach
(
statId
->
{
System
.
out
.
printf
(
"[数据清理-统计] 删除id为 %d 的统计数据 %n"
,
statId
);
statRepo
.
deleteById
(
statId
);
});
StreamSupport
.
stream
(
jsonNode
.
get
(
"data"
).
get
(
"detailId"
).
spliterator
(),
false
)
.
map
(
JsonNode:
:
asInt
)
.
forEach
(
detailId
->
{
System
.
out
.
printf
(
"[数据清理-自查] 删除id为 %d 的自查数据 %n"
,
detailId
);
detailRepo
.
deleteById
(
detailId
);
});
StreamSupport
.
stream
(
jsonNode
.
get
(
"data"
).
get
(
"taskId"
).
spliterator
(),
false
)
.
map
(
JsonNode:
:
asInt
)
.
forEach
(
taskId
->
{
System
.
out
.
printf
(
"[数据清理-任务] 删除id为 %d 的任务数据 %n"
,
taskId
);
taskRepo
.
deleteById
(
taskId
);
});
}
}
@Test
@Test
...
...
dev-union/src/test/java/com/tykj/dev/union/BaseTest.java
浏览文件 @
b99865e2
...
@@ -4,6 +4,7 @@ import org.junit.runner.RunWith;
...
@@ -4,6 +4,7 @@ import org.junit.runner.RunWith;
import
org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
;
import
org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.transaction.annotation.Transactional
;
/**
/**
* BaseTest.
* BaseTest.
...
@@ -14,5 +15,6 @@ import org.springframework.test.context.junit4.SpringRunner;
...
@@ -14,5 +15,6 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
UnionApplication
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@SpringBootTest
(
classes
=
UnionApplication
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@AutoConfigureMockMvc
@AutoConfigureMockMvc
@Transactional
public
class
BaseTest
{
public
class
BaseTest
{
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论