Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
dd0485c6
提交
dd0485c6
authored
10月 20, 2021
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(配套设备模块): 打印和更新标签
打印和更新标签
上级
59f63423
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
95 行增加
和
25 行删除
+95
-25
MatchingDeviceController.java
.../device/matching/controller/MatchingDeviceController.java
+9
-25
MatchingDeviceLibraryService.java
...device/matching/service/MatchingDeviceLibraryService.java
+12
-0
MatchingDeviceLibraryServiceImpl.java
...tching/service/impl/MatchingDeviceLibraryServiceImpl.java
+74
-0
没有找到文件。
dev-matching/src/main/java/com/tykj/dev/device/matching/controller/MatchingDeviceController.java
浏览文件 @
dd0485c6
...
@@ -717,33 +717,17 @@ public class MatchingDeviceController {
...
@@ -717,33 +717,17 @@ public class MatchingDeviceController {
@PostMapping
(
value
=
"/print"
)
@PostMapping
(
value
=
"/print"
)
@org
.
springframework
.
transaction
.
annotation
.
Transactional
(
rollbackFor
=
Exception
.
class
)
@org
.
springframework
.
transaction
.
annotation
.
Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
printRfid
(
@RequestBody
List
<
RfidPrintVo
>
rfid
)
{
public
ResponseEntity
printRfid
(
@RequestBody
List
<
RfidPrintVo
>
rfid
)
{
Map
<
String
,
MatchingDeviceLibrary
>
map
=
matchingDeviceLibraryService
.
getAllMatchingDeviceSeqNumber
();
matchingDeviceLibraryService
.
printRfid
(
rfid
);
List
<
DeviceLogDto
>
deviceLogDtos
=
new
ArrayList
<>();
List
<
PrintVo
>
printVos
=
new
ArrayList
<>();
//调用打印服务 批量打印
for
(
RfidPrintVo
printVo
:
rfid
)
{
MatchingDeviceLibrary
matchingDeviceLibrary
=
map
.
get
(
printVo
.
getMatchingDeviceSeq
());
PrintVo
printVo1
=
new
PrintVo
(
RfidServiceImpl
.
completeRfidStr
(
String
.
valueOf
(
matchingDeviceLibrary
.
getId
())),
matchingDeviceLibrary
.
getModel
(),
matchingDeviceLibrary
.
getName
(),
matchingDeviceLibrary
.
getSeqNumber
());
printVos
.
add
(
printVo1
);
if
(
""
.
equals
(
matchingDeviceLibrary
.
getRfidCardId
()))
{
matchingDeviceLibrary
.
setRfidCardId
(
RfidServiceImpl
.
completeRfidStr
(
String
.
valueOf
(
matchingDeviceLibrary
.
getId
())));
matchingDeviceLibraryService
.
update
(
matchingDeviceLibrary
);
deviceLogDtos
.
add
(
new
DeviceLogDto
(
matchingDeviceLibrary
.
getId
(),
"打印标签"
,
null
,
null
,
null
));
}
else
{
deviceLogDtos
.
add
(
new
DeviceLogDto
(
matchingDeviceLibrary
.
getId
(),
"更换标签"
,
null
,
null
,
null
));
}
}
rfidService
.
printString
(
printVos
.
stream
().
sorted
(
Comparator
.
comparing
(
PrintVo:
:
getRfidContent
)).
collect
(
Collectors
.
toList
()));
deviceLogService
.
addAllLog
(
deviceLogDtos
);
return
ResultUtil
.
success
(
"打印成功"
);
return
ResultUtil
.
success
(
"打印成功"
);
}
}
@ApiOperation
(
value
=
"打印或者更新rfid"
,
notes
=
"打印rfid"
)
@GetMapping
(
"/print/matchingDeviceId"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
printRfid
(
Integer
id
)
{
MatchingDeviceLibrary
matchingDeviceLibrary
=
matchingDeviceLibraryService
.
printRfid
(
id
);
return
ResponseEntity
.
ok
(
matchingDeviceLibrary
.
getRfidCardId
());
}
/**
/**
* @return 生成配套设备附件的序列号
* @return 生成配套设备附件的序列号
*/
*/
...
...
dev-matching/src/main/java/com/tykj/dev/device/matching/service/MatchingDeviceLibraryService.java
浏览文件 @
dd0485c6
...
@@ -5,6 +5,7 @@ import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
...
@@ -5,6 +5,7 @@ import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import
com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary
;
import
com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary
;
import
com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo
;
import
com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo
;
import
com.tykj.dev.device.matching.subject.vo.RelationDeviceVo
;
import
com.tykj.dev.device.matching.subject.vo.RelationDeviceVo
;
import
com.tykj.dev.rfid.entity.vo.RfidPrintVo
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
...
@@ -80,4 +81,15 @@ public interface MatchingDeviceLibraryService {
...
@@ -80,4 +81,15 @@ public interface MatchingDeviceLibraryService {
* 获取配套设备的序列号
* 获取配套设备的序列号
*/
*/
Map
<
String
,
MatchingDeviceLibrary
>
getAllMatchingDeviceSeqNumber
();
Map
<
String
,
MatchingDeviceLibrary
>
getAllMatchingDeviceSeqNumber
();
/**
* 打印标签
*/
void
printRfid
(
List
<
RfidPrintVo
>
rfid
);
/**
* 打印或者更新标签
* @param matchingDeviceId 配套设备的id
*/
MatchingDeviceLibrary
printRfid
(
Integer
matchingDeviceId
);
}
}
dev-matching/src/main/java/com/tykj/dev/device/matching/service/impl/MatchingDeviceLibraryServiceImpl.java
浏览文件 @
dd0485c6
...
@@ -5,6 +5,8 @@ import com.github.wenhao.jpa.Specifications;
...
@@ -5,6 +5,8 @@ import com.github.wenhao.jpa.Specifications;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLogService
;
import
com.tykj.dev.device.library.subject.Dto.DeviceLogDto
;
import
com.tykj.dev.device.library.subject.Dto.DeviceLogDto
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao
;
import
com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao
;
...
@@ -18,11 +20,18 @@ import com.tykj.dev.misc.exception.ApiException;
...
@@ -18,11 +20,18 @@ import com.tykj.dev.misc.exception.ApiException;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.PageUtil
;
import
com.tykj.dev.misc.utils.PageUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.rfid.entity.vo.PrintVo
;
import
com.tykj.dev.rfid.entity.vo.RfidPrintVo
;
import
com.tykj.dev.rfid.service.RfidService
;
import
com.tykj.dev.rfid.service.impl.RfidServiceImpl
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
javax.persistence.Transient
;
import
javax.persistence.Transient
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
...
@@ -49,6 +58,12 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
...
@@ -49,6 +58,12 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
@Autowired
@Autowired
private
BlockChainUtil
blockChainUtil
;
private
BlockChainUtil
blockChainUtil
;
@Autowired
private
DeviceLogService
deviceLogService
;
@Autowired
private
RfidService
rfidService
;
@Override
@Override
public
MatchingDeviceLibrary
addEntity
(
MatchingDeviceLibrary
matchingDeviceLibraryEntity
)
{
public
MatchingDeviceLibrary
addEntity
(
MatchingDeviceLibrary
matchingDeviceLibraryEntity
)
{
MatchingDeviceLibrary
matchingDeviceLibrary
=
matchingDeviceLibraryDao
.
save
(
matchingDeviceLibraryEntity
);
MatchingDeviceLibrary
matchingDeviceLibrary
=
matchingDeviceLibraryDao
.
save
(
matchingDeviceLibraryEntity
);
...
@@ -235,6 +250,65 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
...
@@ -235,6 +250,65 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
MatchingDeviceLibrary:
:
getSeqNumber
,
Function
.
identity
()));
MatchingDeviceLibrary:
:
getSeqNumber
,
Function
.
identity
()));
}
}
@Override
public
void
printRfid
(
List
<
RfidPrintVo
>
rfid
)
{
Map
<
String
,
MatchingDeviceLibrary
>
map
=
getAllMatchingDeviceSeqNumber
();
List
<
DeviceLogDto
>
deviceLogDtos
=
new
ArrayList
<>();
List
<
PrintVo
>
printVos
=
new
ArrayList
<>();
//调用打印服务 批量打印
for
(
RfidPrintVo
printVo
:
rfid
)
{
MatchingDeviceLibrary
matchingDeviceLibrary
=
map
.
get
(
printVo
.
getMatchingDeviceSeq
());
PrintVo
printVo1
=
new
PrintVo
(
RfidServiceImpl
.
completeRfidStr
(
matchingDeviceLibrary
.
getSeqNumber
()),
matchingDeviceLibrary
.
getModel
(),
matchingDeviceLibrary
.
getName
(),
matchingDeviceLibrary
.
getSeqNumber
());
printVos
.
add
(
printVo1
);
if
(
""
.
equals
(
matchingDeviceLibrary
.
getRfidCardId
()))
{
matchingDeviceLibrary
.
setRfidCardId
(
RfidServiceImpl
.
completeRfidStr
(
matchingDeviceLibrary
.
getSeqNumber
()));
update
(
matchingDeviceLibrary
);
deviceLogDtos
.
add
(
new
DeviceLogDto
(
matchingDeviceLibrary
.
getId
(),
"打印标签"
,
null
,
null
,
null
));
}
else
{
deviceLogDtos
.
add
(
new
DeviceLogDto
(
matchingDeviceLibrary
.
getId
(),
"更换标签"
,
null
,
null
,
null
));
}
}
rfidService
.
printString
(
printVos
.
stream
().
sorted
(
Comparator
.
comparing
(
PrintVo:
:
getRfidContent
))
.
collect
(
Collectors
.
toList
()));
deviceLogService
.
addAllLog
(
deviceLogDtos
);
}
@Override
public
MatchingDeviceLibrary
printRfid
(
Integer
matchingDeviceId
)
{
MatchingDeviceLibrary
matchingDeviceLibrary
=
getOne
(
matchingDeviceId
);
DeviceLogDto
deviceLogDto
=
null
;
// List<PrintVo> printVos = new ArrayList<>();
PrintVo
printVo1
=
new
PrintVo
(
RfidServiceImpl
.
completeRfidStr
(
matchingDeviceLibrary
.
getSeqNumber
()),
matchingDeviceLibrary
.
getModel
(),
matchingDeviceLibrary
.
getName
(),
matchingDeviceLibrary
.
getSeqNumber
());
if
(
""
.
equals
(
matchingDeviceLibrary
.
getRfidCardId
()))
{
matchingDeviceLibrary
.
setRfidCardId
(
RfidServiceImpl
.
completeRfidStr
(
matchingDeviceLibrary
.
getSeqNumber
()));
if
(
rfidService
.
printString1
(
printVo1
)){
update
(
matchingDeviceLibrary
);
deviceLogDto
=
new
DeviceLogDto
(
matchingDeviceLibrary
.
getId
(),
"打印标签"
,
null
,
null
,
null
);
}
}
else
{
rfidService
.
printString1
(
printVo1
);
deviceLogDto
=
new
DeviceLogDto
(
matchingDeviceLibrary
.
getId
(),
"更新标签"
,
null
,
null
,
null
);
}
// printVos.add(printVo1);
// rfidService.printString(printVos.stream().sorted(Comparator.comparing(PrintVo::getRfidContent)).collect(Collectors.toList()));
deviceLogService
.
addLog
(
deviceLogDto
);
return
matchingDeviceLibrary
;
}
/**
/**
* @param matchingDeviceSelectVo 配套设备查询vo
* @param matchingDeviceSelectVo 配套设备查询vo
* 创建通用查询条件筛选器
* 创建通用查询条件筛选器
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论