Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
eb5b3e6c
提交
eb5b3e6c
authored
3月 24, 2022
作者:
zjm
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of git.yfzx.zjtys.com.cn:matrix/device-back
上级
7ea770f8
3b87f4fc
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
275 行增加
和
264 行删除
+275
-264
RepairController.java
...m/tykj/dev/device/repair/controller/RepairController.java
+1
-1
DataInit.java
dev-union/src/main/java/com/tykj/dev/union/DataInit.java
+263
-263
RunController.java
...union/src/main/java/com/tykj/dev/union/RunController.java
+11
-0
没有找到文件。
dev-repair/src/main/java/com/tykj/dev/device/repair/controller/RepairController.java
浏览文件 @
eb5b3e6c
...
...
@@ -785,7 +785,7 @@ public class RepairController {
//存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList, taskBto.getId());
DeviceLogDto
deviceLogDto
;
if
(
repairReceiveVo
.
getRightSignatureId
()
!=
null
&&
""
.
equals
(
repairReceiveVo
.
getRightSignatureId
())){
if
(
repairReceiveVo
.
getRightSignatureId
()
!=
null
&&
!
""
.
equals
(
repairReceiveVo
.
getRightSignatureId
())){
deviceLogDto
=
new
DeviceLogDto
(
id
,
"接收并发起入库(签章入库)"
,
fileVoList
,
taskBto
.
getId
(),
taskBto
.
getId
());
}
deviceLogDto
=
new
DeviceLogDto
(
id
,
"接收并发起入库(签字入库)"
,
fileVoList
,
taskBto
.
getId
(),
taskBto
.
getId
());
...
...
dev-union/src/main/java/com/tykj/dev/union/DataInit.java
浏览文件 @
eb5b3e6c
//
package com.tykj.dev.union;
//
//
import com.tykj.dev.device.allot.repository.AllotBackBillDao;
//
import com.tykj.dev.device.allot.repository.AllotBillDao;
//
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
//
import com.tykj.dev.device.allot.subject.domin.AllotBill;
//
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
//
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
//
import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
//
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
//
import com.tykj.dev.device.repair.repository.RepairBackBillDao;
//
import com.tykj.dev.device.repair.repository.RepairBillDao;
//
import com.tykj.dev.device.repair.repository.RepairDetailDao;
//
import com.tykj.dev.device.repair.repository.RepairSendBillDao;
//
import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
//
import com.tykj.dev.device.repair.subject.domin.RepairBill;
//
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
//
import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
//
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
//
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
//
import com.tykj.dev.device.user.subject.dao.UnitsDao;
//
import com.tykj.dev.device.user.subject.entity.Units;
//
import com.tykj.dev.device.user.util.AuthenticationUtils;
//
import com.tykj.dev.device.user.util.UserUtils;
//
import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
//
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
//
import com.tykj.dev.misc.utils.SpringUtils;
//
import lombok.extern.slf4j.Slf4j;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.boot.CommandLineRunner;
//
import org.springframework.context.annotation.Bean;
//
import org.springframework.context.annotation.DependsOn;
//
import org.springframework.core.annotation.Order;
//
import org.springframework.stereotype.Component;
//
import org.springframework.transaction.annotation.Transactional;
//
//
import javax.annotation.PostConstruct;
//
import javax.annotation.Resource;
//
import java.util.Collections;
//
import java.util.List;
//
//
@Slf4j
//
@Component
//
public class DataInit {
//
//
@Resource
//
private UnitsDao unitsDao;
//
//
@Autowired
//
private AllotBillDao allotBillDao;
//
@Autowired
//
private AllotBackBillDao allotBackBillDao;
//
@Autowired
//
private RepairBackBillDao repairBackBillDao;
//
@Autowired
//
private RepairDetailDao repairDetailDao;
//
@Autowired
//
private RepairSendBillDao repairSendBillDao;
//
@Autowired
//
private RepairBillDao repairBillDao;
//
@Autowired
//
private SelfCheckBillDao selfCheckBillDao;
//
@Autowired
//
private DeviceUseReportDao deviceUseReportDao;
//
//
@Autowired
//
private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
//
//
@Autowired
//
private UserUtils userUtils;
//
//
@Autowired
//
private SpringUtils springUtils;
//
//
@Autowired
//
private com.tykj.dev.device.user.util.AuthenticationUtils AuthenticationUtils;
//
//
private void initCheckDetailUnitName() {
//
// 对现有的数据补充unitId信息
//
allotBillDao.findAll().forEach(this::saveModifyDetail1);
//
allotBackBillDao.findAll().forEach(this::saveModifyDetail2);
//
selfCheckBillDao.findAll().forEach(this::saveModifyDetail3);
//
repairBillDao.findAll().forEach(this::saveModifyDetail4);
//
repairSendBillDao.findAll().forEach(this::saveModifyDetail5);
//
repairDetailDao.findAll().forEach(this::saveModifyDetail6);
//
repairBackBillDao.findAll().forEach(this::saveModifyDetail7);
//
deviceUseReportDao.findAll().forEach(this::saveModifyDetail8);
//
matchingDeviceLibraryDao.findAll().forEach(this::saveModifyDetail9);
//
}
//
//
//
private void saveModifyDetail1(AllotBill allotBill) {
//
String receiveUnit = allotBill.getReceiveUnit();
//
String sendUnit = allotBill.getSendUnit();
//
//
Integer receiveUnitId = getUnitId(receiveUnit);
//
Integer sendUnitId = getUnitId(sendUnit);
//
//
if (receiveUnitId != -1 && sendUnitId != -1) {
//
allotBill.setReceiveUnitId(receiveUnitId);
//
allotBill.setSendUnitId(sendUnitId);
//
log.info("[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
//
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
//
allotBillDao.save(allotBill);
//
}
//
//
}
//
//
private void saveModifyDetail2(AllotBackBill allotBackBill) {
//
String receiveUnit = allotBackBill.getReceiveUnit();
//
String sendUnit = allotBackBill.getSendUnit();
//
//
Integer receiveUnitId = getUnitId(receiveUnit);
//
Integer sendUnitId = getUnitId(sendUnit);
//
//
if (receiveUnitId != -1 && sendUnitId != -1) {
//
allotBackBill.setReceiveUnitId(receiveUnitId);
//
allotBackBill.setSendUnitId(sendUnitId);
//
log.info("[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
//
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
//
allotBackBillDao.save(allotBackBill);
//
}
//
//
}
//
//
private void saveModifyDetail3(SelfCheckBill selfCheckBill) {
//
String receiveUnit = selfCheckBill.getCheckUnit();
//
Integer receiveUnitId = getUnitId(receiveUnit);
//
if (receiveUnitId != -1) {
//
selfCheckBill.setCheckUnitId(receiveUnitId);
//
log.info("[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}",
//
receiveUnit,receiveUnitId);
//
selfCheckBillDao.save(selfCheckBill);
//
}
//
//
}
//
//
private void saveModifyDetail4(RepairBill allotBill) {
//
String receiveUnit = allotBill.getReceiveUnit();
//
String sendUnit = allotBill.getSendUnit();
//
//
Integer receiveUnitId = getUnitId(receiveUnit);
//
Integer sendUnitId = getUnitId(sendUnit);
//
//
if (receiveUnitId != -1 && sendUnitId != -1) {
//
allotBill.setReceiveUnitId(receiveUnitId);
//
allotBill.setSendUnitId(sendUnitId);
//
log.info("[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
//
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
//
repairBillDao.save(allotBill);
//
}
//
//
}
//
//
private void saveModifyDetail5(RepairSendBill allotBill) {
//
String receiveUnit = allotBill.getReceiveUnit();
//
String sendUnit = allotBill.getSendUnit();
//
//
Integer receiveUnitId = getUnitId(receiveUnit);
//
Integer sendUnitId = getUnitId(sendUnit);
//
//
if (receiveUnitId != -1 && sendUnitId != -1) {
//
allotBill.setReceiveUnitId(receiveUnitId);
//
allotBill.setSendUnitId(sendUnitId);
//
log.info("[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
//
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
//
repairSendBillDao.save(allotBill);
//
}
//
//
}
//
//
private void saveModifyDetail6(RepairDetail allotBill) {
//
String receiveUnit = allotBill.getLocationUnit();
//
String sendUnit = allotBill.getOwnUnit();
//
//
Integer receiveUnitId = getUnitId(receiveUnit);
//
Integer sendUnitId = getUnitId(sendUnit);
//
//
if (receiveUnitId != -1 && sendUnitId != -1) {
//
allotBill.setLocationUnitId(receiveUnitId);
//
allotBill.setOwnUnitId(sendUnitId);
//
log.info("[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
//
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
//
repairDetailDao.save(allotBill);
//
}
//
//
}
//
private void saveModifyDetail7(RepairBackBill allotBill) {
//
String receiveUnit = allotBill.getReceiveUnit();
//
String sendUnit = allotBill.getSendUnit();
//
//
Integer receiveUnitId = getUnitId(receiveUnit);
//
Integer sendUnitId = getUnitId(sendUnit);
//
//
if (receiveUnitId != -1 && sendUnitId != -1) {
//
allotBill.setReceiveUnitId(receiveUnitId);
//
allotBill.setSendUnitId(sendUnitId);
//
log.info("[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
//
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
//
repairBackBillDao.save(allotBill);
//
}
//
//
}
//
//
private void saveModifyDetail8(DeviceUseReport allotBill) {
//
String receiveUnit = allotBill.getUnit();
//
Integer receiveUnitId = getUnitId(receiveUnit);
//
if (receiveUnitId != -1 ) {
//
allotBill.setUnitId(receiveUnitId);
//
log.info("[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}",
//
receiveUnit,receiveUnitId);
//
deviceUseReportDao.save(allotBill);
//
}
//
//
}
//
//
private void saveModifyDetail9(MatchingDeviceLibrary matchingDeviceLibrary) {
//
String createUnit = matchingDeviceLibrary.getCreateUnit();
//
Integer createUnitId = getUnitId(createUnit);
//
if (createUnitId != -1 ) {
//
matchingDeviceLibrary.setCreateUnitId(createUnitId);
//
log.info("[配套设备库] 修正MatchingDeviceLibrary历史数据,修正的单位:{},接收单位id:{}",
//
createUnit,createUnitId);
//
matchingDeviceLibraryDao.save(matchingDeviceLibrary);
//
}
//
//
}
//
//
private Integer getUnitId(String unitName) {
//
List<Units> units = unitsDao.findAllByName(unitName).orElse(Collections.emptyList());
//
return units.size() == 1 ? units.get(0).getUnitId() : -1;
//
}
//
//
//
@Bean
//
//
@DependsOn("userUtils")
package
com
.
tykj
.
dev
.
union
;
import
com.tykj.dev.device.allot.repository.AllotBackBillDao
;
import
com.tykj.dev.device.allot.repository.AllotBillDao
;
import
com.tykj.dev.device.allot.subject.domin.AllotBackBill
;
import
com.tykj.dev.device.allot.subject.domin.AllotBill
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao
;
import
com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao
;
import
com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary
;
import
com.tykj.dev.device.repair.repository.RepairBackBillDao
;
import
com.tykj.dev.device.repair.repository.RepairBillDao
;
import
com.tykj.dev.device.repair.repository.RepairDetailDao
;
import
com.tykj.dev.device.repair.repository.RepairSendBillDao
;
import
com.tykj.dev.device.repair.subject.domin.RepairBackBill
;
import
com.tykj.dev.device.repair.subject.domin.RepairBill
;
import
com.tykj.dev.device.repair.subject.domin.RepairDetail
;
import
com.tykj.dev.device.repair.subject.domin.RepairSendBill
;
import
com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao
;
import
com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.util.AuthenticationUtils
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.device.usereport.repository.DeviceUseReportDao
;
import
com.tykj.dev.device.usereport.subject.domin.DeviceUseReport
;
import
com.tykj.dev.misc.utils.SpringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
java.util.Collections
;
import
java.util.List
;
@Slf4j
@Component
public
class
DataInit
{
@Resource
private
UnitsDao
unitsDao
;
@Autowired
private
AllotBillDao
allotBillDao
;
@Autowired
private
AllotBackBillDao
allotBackBillDao
;
@Autowired
private
RepairBackBillDao
repairBackBillDao
;
@Autowired
private
RepairDetailDao
repairDetailDao
;
@Autowired
private
RepairSendBillDao
repairSendBillDao
;
@Autowired
private
RepairBillDao
repairBillDao
;
@Autowired
private
SelfCheckBillDao
selfCheckBillDao
;
@Autowired
private
DeviceUseReportDao
deviceUseReportDao
;
@Autowired
private
MatchingDeviceLibraryDao
matchingDeviceLibraryDao
;
@Autowired
private
UserUtils
userUtils
;
@Autowired
private
SpringUtils
springUtils
;
@Autowired
private
com
.
tykj
.
dev
.
device
.
user
.
util
.
AuthenticationUtils
AuthenticationUtils
;
private
void
initCheckDetailUnitName
()
{
// 对现有的数据补充unitId信息
allotBillDao
.
findAll
().
forEach
(
this
::
saveModifyDetail1
);
allotBackBillDao
.
findAll
().
forEach
(
this
::
saveModifyDetail2
);
selfCheckBillDao
.
findAll
().
forEach
(
this
::
saveModifyDetail3
);
repairBillDao
.
findAll
().
forEach
(
this
::
saveModifyDetail4
);
repairSendBillDao
.
findAll
().
forEach
(
this
::
saveModifyDetail5
);
repairDetailDao
.
findAll
().
forEach
(
this
::
saveModifyDetail6
);
repairBackBillDao
.
findAll
().
forEach
(
this
::
saveModifyDetail7
);
deviceUseReportDao
.
findAll
().
forEach
(
this
::
saveModifyDetail8
);
matchingDeviceLibraryDao
.
findAll
().
forEach
(
this
::
saveModifyDetail9
);
}
private
void
saveModifyDetail1
(
AllotBill
allotBill
)
{
String
receiveUnit
=
allotBill
.
getReceiveUnit
();
String
sendUnit
=
allotBill
.
getSendUnit
();
Integer
receiveUnitId
=
getUnitId
(
receiveUnit
);
Integer
sendUnitId
=
getUnitId
(
sendUnit
);
if
(
receiveUnitId
!=
-
1
&&
sendUnitId
!=
-
1
)
{
allotBill
.
setReceiveUnitId
(
receiveUnitId
);
allotBill
.
setSendUnitId
(
sendUnitId
);
log
.
info
(
"[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}"
,
sendUnit
,
receiveUnit
,
sendUnitId
,
receiveUnitId
);
allotBillDao
.
save
(
allotBill
);
}
}
private
void
saveModifyDetail2
(
AllotBackBill
allotBackBill
)
{
String
receiveUnit
=
allotBackBill
.
getReceiveUnit
();
String
sendUnit
=
allotBackBill
.
getSendUnit
();
Integer
receiveUnitId
=
getUnitId
(
receiveUnit
);
Integer
sendUnitId
=
getUnitId
(
sendUnit
);
if
(
receiveUnitId
!=
-
1
&&
sendUnitId
!=
-
1
)
{
allotBackBill
.
setReceiveUnitId
(
receiveUnitId
);
allotBackBill
.
setSendUnitId
(
sendUnitId
);
log
.
info
(
"[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}"
,
sendUnit
,
receiveUnit
,
sendUnitId
,
receiveUnitId
);
allotBackBillDao
.
save
(
allotBackBill
);
}
}
private
void
saveModifyDetail3
(
SelfCheckBill
selfCheckBill
)
{
String
receiveUnit
=
selfCheckBill
.
getCheckUnit
();
Integer
receiveUnitId
=
getUnitId
(
receiveUnit
);
if
(
receiveUnitId
!=
-
1
)
{
selfCheckBill
.
setCheckUnitId
(
receiveUnitId
);
log
.
info
(
"[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}"
,
receiveUnit
,
receiveUnitId
);
selfCheckBillDao
.
save
(
selfCheckBill
);
}
}
private
void
saveModifyDetail4
(
RepairBill
allotBill
)
{
String
receiveUnit
=
allotBill
.
getReceiveUnit
();
String
sendUnit
=
allotBill
.
getSendUnit
();
Integer
receiveUnitId
=
getUnitId
(
receiveUnit
);
Integer
sendUnitId
=
getUnitId
(
sendUnit
);
if
(
receiveUnitId
!=
-
1
&&
sendUnitId
!=
-
1
)
{
allotBill
.
setReceiveUnitId
(
receiveUnitId
);
allotBill
.
setSendUnitId
(
sendUnitId
);
log
.
info
(
"[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}"
,
sendUnit
,
receiveUnit
,
sendUnitId
,
receiveUnitId
);
repairBillDao
.
save
(
allotBill
);
}
}
private
void
saveModifyDetail5
(
RepairSendBill
allotBill
)
{
String
receiveUnit
=
allotBill
.
getReceiveUnit
();
String
sendUnit
=
allotBill
.
getSendUnit
();
Integer
receiveUnitId
=
getUnitId
(
receiveUnit
);
Integer
sendUnitId
=
getUnitId
(
sendUnit
);
if
(
receiveUnitId
!=
-
1
&&
sendUnitId
!=
-
1
)
{
allotBill
.
setReceiveUnitId
(
receiveUnitId
);
allotBill
.
setSendUnitId
(
sendUnitId
);
log
.
info
(
"[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}"
,
sendUnit
,
receiveUnit
,
sendUnitId
,
receiveUnitId
);
repairSendBillDao
.
save
(
allotBill
);
}
}
private
void
saveModifyDetail6
(
RepairDetail
allotBill
)
{
String
receiveUnit
=
allotBill
.
getLocationUnit
();
String
sendUnit
=
allotBill
.
getOwnUnit
();
Integer
receiveUnitId
=
getUnitId
(
receiveUnit
);
Integer
sendUnitId
=
getUnitId
(
sendUnit
);
if
(
receiveUnitId
!=
-
1
&&
sendUnitId
!=
-
1
)
{
allotBill
.
setLocationUnitId
(
receiveUnitId
);
allotBill
.
setOwnUnitId
(
sendUnitId
);
log
.
info
(
"[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}"
,
sendUnit
,
receiveUnit
,
sendUnitId
,
receiveUnitId
);
repairDetailDao
.
save
(
allotBill
);
}
}
private
void
saveModifyDetail7
(
RepairBackBill
allotBill
)
{
String
receiveUnit
=
allotBill
.
getReceiveUnit
();
String
sendUnit
=
allotBill
.
getSendUnit
();
Integer
receiveUnitId
=
getUnitId
(
receiveUnit
);
Integer
sendUnitId
=
getUnitId
(
sendUnit
);
if
(
receiveUnitId
!=
-
1
&&
sendUnitId
!=
-
1
)
{
allotBill
.
setReceiveUnitId
(
receiveUnitId
);
allotBill
.
setSendUnitId
(
sendUnitId
);
log
.
info
(
"[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}"
,
sendUnit
,
receiveUnit
,
sendUnitId
,
receiveUnitId
);
repairBackBillDao
.
save
(
allotBill
);
}
}
private
void
saveModifyDetail8
(
DeviceUseReport
allotBill
)
{
String
receiveUnit
=
allotBill
.
getUnit
();
Integer
receiveUnitId
=
getUnitId
(
receiveUnit
);
if
(
receiveUnitId
!=
-
1
)
{
allotBill
.
setUnitId
(
receiveUnitId
);
log
.
info
(
"[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}"
,
receiveUnit
,
receiveUnitId
);
deviceUseReportDao
.
save
(
allotBill
);
}
}
private
void
saveModifyDetail9
(
MatchingDeviceLibrary
matchingDeviceLibrary
)
{
String
createUnit
=
matchingDeviceLibrary
.
getCreateUnit
();
Integer
createUnitId
=
getUnitId
(
createUnit
);
if
(
createUnitId
!=
-
1
)
{
matchingDeviceLibrary
.
setCreateUnitId
(
createUnitId
);
log
.
info
(
"[配套设备库] 修正MatchingDeviceLibrary历史数据,修正的单位:{},接收单位id:{}"
,
createUnit
,
createUnitId
);
matchingDeviceLibraryDao
.
save
(
matchingDeviceLibrary
);
}
}
private
Integer
getUnitId
(
String
unitName
)
{
List
<
Units
>
units
=
unitsDao
.
findAllByName
(
unitName
).
orElse
(
Collections
.
emptyList
());
return
units
.
size
()
==
1
?
units
.
get
(
0
).
getUnitId
()
:
-
1
;
}
// @Bean
// @DependsOn("userUtils")
// @PostConstruct
// public void init2(){
public
void
init2
(){
log
.
info
(
"单位名称初始化-----"
);
initCheckDetailUnitName
();
initCheckDetailUnitName2
();
}
@Autowired
private
DeviceCheckDetailDao
deviceCheckDetailDao
;
private
void
initCheckDetailUnitName2
()
{
// 对现有的数据补充unitId信息
deviceCheckDetailDao
.
findAll
().
forEach
(
this
::
saveModifyDetail
);
}
private
void
saveModifyDetail
(
DeviceCheckDetail
deviceCheckDetail
)
{
String
checkUnit
=
deviceCheckDetail
.
getCheckUnit
();
Integer
unitId
=
getUnitId
(
checkUnit
);
if
(
unitId
!=
-
1
)
{
deviceCheckDetail
.
setCheckUnitId
(
unitId
);
log
.
info
(
"[核查] 修正detail历史数据,修正的单位:{},单位id:{}"
,
checkUnit
,
unitId
);
deviceCheckDetailDao
.
save
(
deviceCheckDetail
);
}
}
// @Override
// @Order(value = 1)
// public void run(String... args) throws Exception {
// log.info("单位名称初始化-----");
// initCheckDetailUnitName();
// initCheckDetailUnitName2();
// }
//
// @Autowired
// private DeviceCheckDetailDao
// deviceCheckDetailDao;
//
// private void initCheckDetailUnitName2() {
// // 对现有的数据补充unitId信息
// deviceCheckDetailDao.findAll().forEach(this::saveModifyDetail);
// }
//
// private void saveModifyDetail(DeviceCheckDetail deviceCheckDetail) {
// String checkUnit = deviceCheckDetail.getCheckUnit();
// Integer unitId = getUnitId(checkUnit);
// if (unitId != -1) {
// deviceCheckDetail.setCheckUnitId(unitId);
// log.info("[核查] 修正detail历史数据,修正的单位:{},单位id:{}", checkUnit, unitId);
// deviceCheckDetailDao.save(deviceCheckDetail);
// }
// }
//// @Override
//// @Order(value = 1)
//// public void run(String... args) throws Exception {
//// log.info("单位名称初始化-----");
//// initCheckDetailUnitName();
//// }
//}
}
dev-union/src/main/java/com/tykj/dev/union/RunController.java
浏览文件 @
eb5b3e6c
...
...
@@ -53,6 +53,9 @@ public class RunController {
@Autowired
private
MatchingDeviceLibraryService
matchingDeviceLibraryService
;
@Autowired
DataInit
dataInit
;
@ApiOperation
(
value
=
"修改单位名称从而修改配套设备的创建单位"
,
notes
=
"修改单位名称从而修改配套设备的创建单位"
)
@PostMapping
(
"/device/updateDeviceLocationAndOwnUnit"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -73,5 +76,13 @@ public class RunController {
return
ResponseEntity
.
ok
(
"修改成功"
);
}
@ApiOperation
(
value
=
"修改单位名称从而修改配套设备的创建单位"
,
notes
=
"修改单位名称从而修改配套设备的创建单位"
)
@GetMapping
(
"/run/init"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
<
String
>
run
()
{
dataInit
.
init2
();
return
ResponseEntity
.
ok
(
"修改成功"
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论