Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
67ca4b65
Commit
67ca4b65
authored
Jan 06, 2023
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化装备导入
parent
0da3d898
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
36 deletions
+56
-36
EquipmentServiceImpl.java
...eejoin/equipmanage/service/impl/EquipmentServiceImpl.java
+20
-2
StockServiceImpl.java
...om/yeejoin/equipmanage/service/impl/StockServiceImpl.java
+36
-34
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentServiceImpl.java
View file @
67ca4b65
...
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.vo.*
;
...
...
@@ -17,6 +18,7 @@ import org.apache.commons.lang3.RandomStringUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -57,6 +59,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
@Autowired
private
IEquipmentDetailService
iEquipmentDetailService
;
@Autowired
private
RedisUtils
redisUtils
;
// 装备分类code长度
private
static
final
int
CATECODELEN
=
8
;
private
String
proviceCode
=
"44"
;
...
...
@@ -111,10 +116,10 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
}
equipmentMapper
.
deleteById
(
equipment
.
getId
());
});
refreshData
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"删除失败!"
);
}
}
@Override
...
...
@@ -140,10 +145,22 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
log
.
error
(
"新增装备定义操作中,检测到巡检服务未启动或启动出错!"
);
}
if
(
num
>
0
)
{
refreshData
();
return
true
;
}
return
false
;
}
}
@Async
public
void
refreshData
()
{
if
(
redisUtils
.
hasKey
(
"equip_equipDefinitions"
))
{
redisUtils
.
del
(
"equip_equipDefinitions"
);
}
QueryWrapper
<
Equipment
>
equipmentQueryWrapper
=
new
QueryWrapper
<>();
equipmentQueryWrapper
.
isNotNull
(
"id"
);
List
<
Equipment
>
equipments
=
equipmentMapper
.
selectList
(
equipmentQueryWrapper
);
redisUtils
.
set
(
"equip_equipDefinitions"
,
JSONObject
.
toJSONString
(
equipments
));
}
// public void saveEquipmentQRCodes(Equipment equipment) {
// try {
...
...
@@ -233,6 +250,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
log
.
error
(
"编辑装备定义操作中,检测到巡检服务未启动或启动出错!"
);
}
if
(
savedEquipment
>
0
)
{
refreshData
();
return
true
;
}
return
false
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/StockServiceImpl.java
View file @
67ca4b65
...
...
@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import
javax.annotation.Resource
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.utils.*
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -32,21 +33,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.equipmanage.common.entity.Equipment
;
import
com.yeejoin.equipmanage.common.entity.EquipmentDetail
;
import
com.yeejoin.equipmanage.common.entity.EquipmentIndex
;
import
com.yeejoin.equipmanage.common.entity.EquipmentManageEntity
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecific
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSystemSourceStatistics
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity
;
import
com.yeejoin.equipmanage.common.entity.Journal
;
import
com.yeejoin.equipmanage.common.entity.ManufacturerInfo
;
import
com.yeejoin.equipmanage.common.entity.Stock
;
import
com.yeejoin.equipmanage.common.entity.StockBill
;
import
com.yeejoin.equipmanage.common.entity.StockBillDetail
;
import
com.yeejoin.equipmanage.common.entity.StockDetail
;
import
com.yeejoin.equipmanage.common.entity.WarehouseStructure
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentDetailDownloadVO
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo
;
import
com.yeejoin.equipmanage.common.enums.BillContentEnum
;
...
...
@@ -507,10 +493,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
relationRedisUtil
.
delSysRedisKey
(
fireFightSysIdsBuffer
.
toString
());
}
if
(
redisUtils
.
hasKey
(
"equipAndCarIotCodes"
))
{
redisUtils
.
del
(
"equipAndCarIotCodes"
);
}
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override
// public void afterCommit() {
...
...
@@ -546,6 +528,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
redisUtils
.
del
(
"equipAndCarIotCodes"
);
}
redisUtils
.
set
(
"equipAndCarIotCodes"
,
JSONObject
.
toJSONString
(
data
));
if
(
redisUtils
.
hasKey
(
"equip_warehouseStructures"
))
{
redisUtils
.
getAndDeletePatternKeys
(
"equip_warehouseStructures"
+
"*"
);
}
return
date
;
}
...
...
@@ -579,11 +565,22 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
TransactionStatus
transactionStatus
=
platformTransactionManager
.
getTransaction
(
transactionDefinition
);
try
{
//查询装备定义信息
QueryWrapper
<
Equipment
>
equipmentQueryWrapper
=
new
QueryWrapper
<>();
equipmentQueryWrapper
.
lambda
().
eq
(
Equipment:
:
getCode
,
equipmentDetailDownloadVOS
.
getCode
());
Equipment
equipment
=
equipmentMapper
.
selectOne
(
equipmentQueryWrapper
);
// equipmentQueryWrapper.lambda().eq(Equipment::getCode, equipmentDetailDownloadVOS.getCode());
// Equipment equipment = equipmentMapper.selectOne(equipmentQueryWrapper);
// 此处由于每次导入都需查装备定义导致导入缓慢,所以优化为加入缓存
Equipment
equipment
;
if
(
redisUtils
.
hasKey
(
"equip_equipDefinitions"
))
{
List
<
Equipment
>
equipmentList
=
JSONObject
.
parseArray
(
redisUtils
.
get
(
"equip_equipDefinitions"
).
toString
(),
Equipment
.
class
);;
equipment
=
equipmentList
.
stream
().
filter
(
x
->
x
.
getCode
().
equals
(
equipmentDetailDownloadVOS
.
getCode
())).
collect
(
Collectors
.
toList
()).
get
(
0
);
}
else
{
QueryWrapper
<
Equipment
>
equipmentQueryWrapper
=
new
QueryWrapper
<>();
equipmentQueryWrapper
.
isNotNull
(
"id"
);
List
<
Equipment
>
equipments
=
equipmentMapper
.
selectList
(
equipmentQueryWrapper
);
equipment
=
equipments
.
stream
().
filter
(
x
->
x
.
getCode
().
equals
(
equipmentDetailDownloadVOS
.
getCode
())).
collect
(
Collectors
.
toList
()).
get
(
0
);
redisUtils
.
set
(
"equip_equipDefinitions"
,
JSONObject
.
toJSONString
(
equipments
));
}
if
(
equipment
==
null
)
{
erryy
.
append
(
String
.
format
(
"装备(器材)编码[%S]填写错误,请输入正确的装备(器材)编码!"
,
equipmentDetailDownloadVOS
.
getCode
())
+
","
);
throw
new
RuntimeException
(
String
.
format
(
"装备(器材)编码[%S]填写错误,请输入正确的装备(器材)编码!"
,
equipmentDetailDownloadVOS
.
getCode
()));
...
...
@@ -604,8 +601,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
throw
new
RuntimeException
(
String
.
format
(
"物联编码[%S]填写重复,请重新输入!"
,
iotCode
));
}
if
(
StringUtils
.
isNotEmpty
(
haveUsedIotPrefix
)
&&
Arrays
.
stream
(
haveUsedIotPrefix
.
split
(
","
)).
anyMatch
(
iotCode:
:
startsWith
)){
erryy
.
append
(
String
.
format
(
"物联编码[%S]
航班
已占用,请重新输入!"
,
iotCode
)+
","
);
throw
new
BadRequest
(
"物联编码
航班
已占用"
);
erryy
.
append
(
String
.
format
(
"物联编码[%S]已占用,请重新输入!"
,
iotCode
)+
","
);
throw
new
BadRequest
(
"物联编码已占用"
);
}
}
AtomicReference
<
String
>
fightSysIds
=
new
AtomicReference
<>(
""
);
...
...
@@ -680,7 +677,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
equipmentSpecific
.
setTeamId
(
fireTeam
[
1
]);
}
// 导入新增所属单位
if
(
StringUtils
.
isNotBlank
(
equipmentDetailDownloadVOS
.
getCompanyName
()))
{
String
[]
company
=
equipmentDetailDownloadVOS
.
getCompanyName
().
split
(
"@"
);
equipmentSpecific
.
setAgencyId
(
company
[
1
]);
...
...
@@ -700,9 +696,19 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
controllerProxy
.
refreshCount
(
equipmentSpecific
.
getBizOrgCode
());
//位置编码不为空入库
if
(
equipmentDetailDownloadVOS
!=
null
&&
equipmentDetailDownloadVOS
.
getWarehouseStructCode
()
!=
null
)
{
QueryWrapper
<
WarehouseStructure
>
warehouseStructureQueryWrapper
=
new
QueryWrapper
<>();
warehouseStructureQueryWrapper
.
lambda
().
eq
(
WarehouseStructure:
:
getCode
,
equipmentDetailDownloadVOS
.
getWarehouseStructCode
());
WarehouseStructure
warehouseStructure
=
warehouseStructureService
.
getOne
(
warehouseStructureQueryWrapper
);
// QueryWrapper<WarehouseStructure> warehouseStructureQueryWrapper = new QueryWrapper<>();
// warehouseStructureQueryWrapper.lambda().eq(WarehouseStructure::getCode, equipmentDetailDownloadVOS.getWarehouseStructCode());
// WarehouseStructure warehouseStructure = warehouseStructureService.getOne(warehouseStructureQueryWrapper);
// 入库位置进行优化
WarehouseStructure
warehouseStructure
;
if
(
redisUtils
.
hasKey
(
"equip_warehouseStructures"
))
{
List
<
WarehouseStructure
>
warehouseStructures
=
JSONObject
.
parseArray
(
redisUtils
.
get
(
"equip_warehouseStructures"
).
toString
(),
WarehouseStructure
.
class
);
warehouseStructure
=
warehouseStructures
.
stream
().
filter
(
x
->
x
.
getCode
().
equals
(
equipmentDetailDownloadVOS
.
getWarehouseStructCode
())).
collect
(
Collectors
.
toList
()).
get
(
0
);
}
else
{
List
<
WarehouseStructure
>
warehouseStructures
=
warehouseStructureService
.
list
();
warehouseStructure
=
warehouseStructures
.
stream
().
filter
(
x
->
x
.
getCode
().
equals
(
equipmentDetailDownloadVOS
.
getWarehouseStructCode
())).
collect
(
Collectors
.
toList
()).
get
(
0
);
redisUtils
.
set
(
"equip_warehouseStructures"
,
JSONObject
.
toJSONString
(
warehouseStructures
));
}
if
(
warehouseStructure
==
null
)
{
erryy
.
append
(
String
.
format
(
"货位编码[%S]填写错误,请输入正确的货位编码!"
,
equipmentDetailDownloadVOS
.
getWarehouseStructCode
())+
","
);
throw
new
RuntimeException
(
String
.
format
(
"货位编码[%S]填写错误,请输入正确的货位编码!"
,
equipmentDetailDownloadVOS
.
getWarehouseStructCode
()));
...
...
@@ -770,7 +776,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
}
list
.
add
(
equipmentSpecific
);
this
.
equipmentSpecificIndexSave
(
equipmentDetail
,
equipmentSpecific
);
platformTransactionManager
.
commit
(
transactionStatus
);
platformTransactionManager
.
commit
(
transactionStatus
);
}
catch
(
Exception
e
)
{
platformTransactionManager
.
rollback
(
transactionStatus
);
errBufferName
.
append
(
equipmentDetailDownloadVOS
.
getCode
()
+
","
);
...
...
@@ -781,10 +787,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
}
// @Async
public
void
refreshCount
(
String
bizOrgCode
)
{
equipmentSpecificSerivce
.
refreshStaData
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment