提交 4e324733 authored 作者: zjm's avatar zjm

合并分支 'bug' 到 'master'

Bug 查看合并请求 !81
...@@ -78,44 +78,44 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -78,44 +78,44 @@ public class BlockChainUtilImpl implements BlockChainUtil {
request.put("subCode", subCode); request.put("subCode", subCode);
request.put("apiSignature", ApiSignatureUtil.getApiSignature(request, SECRET_KEY)); request.put("apiSignature", ApiSignatureUtil.getApiSignature(request, SECRET_KEY));
// switch (index){ switch (index){
// case 1: case 1:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL + BcUrl.SEND_TEXT, BLOCK_CHAIN_URL + BcUrl.SEND_TEXT,
// request, request,
// BcText.class BcText.class
// ); );
// case 2: case 2:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL2 + BcUrl.SEND_TEXT, BLOCK_CHAIN_URL2 + BcUrl.SEND_TEXT,
// request, request,
// BcText.class BcText.class
// ); );
// case 3: case 3:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL3 + BcUrl.SEND_TEXT, BLOCK_CHAIN_URL3 + BcUrl.SEND_TEXT,
// request, request,
// BcText.class BcText.class
// ); );
// case 4: case 4:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL4 + BcUrl.SEND_TEXT, BLOCK_CHAIN_URL4 + BcUrl.SEND_TEXT,
// request, request,
// BcText.class BcText.class
// ); );
// case 5: case 5:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL5 + BcUrl.SEND_TEXT, BLOCK_CHAIN_URL5 + BcUrl.SEND_TEXT,
// request, request,
// BcText.class BcText.class
// ); );
// } }
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL + BcUrl.SEND_TEXT, BLOCK_CHAIN_URL + BcUrl.SEND_TEXT,
// request, request,
// BcText.class BcText.class
// ); );
return new BcText().toData(); // return new BcText().toData();
} }
@Override @Override
...@@ -124,12 +124,13 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -124,12 +124,13 @@ public class BlockChainUtilImpl implements BlockChainUtil {
request.put("content", content); request.put("content", content);
request.put("subCode", subCode); request.put("subCode", subCode);
request.put("apiSignature", ApiSignatureUtil.getApiSignature(request, SECRET_KEY)); request.put("apiSignature", ApiSignatureUtil.getApiSignature(request, SECRET_KEY));
return new BcText().toData();
}
// public static void main(String[] args) { return new RestTemplate().postForObject(
// new BlockChainUtilImpl().sendHash(1,"阿斯顿好看"); BLOCK_CHAIN_URL + BcUrl.SEND_TEXT,
// } request,
BcText.class
);
}
@Override @Override
...@@ -141,7 +142,44 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -141,7 +142,44 @@ public class BlockChainUtilImpl implements BlockChainUtil {
log.info("apiSignature:{}",s); log.info("apiSignature:{}",s);
request.put("apiSignature", s); request.put("apiSignature", s);
return new BcHash().toDate(); switch (index){
case 1:
return new RestTemplate().postForObject(
BLOCK_CHAIN_URL + BcUrl.SEND_HASH,
request,
BcHash.class
);
case 2:
return new RestTemplate().postForObject(
BLOCK_CHAIN_URL2 + BcUrl.SEND_HASH,
request,
BcHash.class
);
case 3:
return new RestTemplate().postForObject(
BLOCK_CHAIN_URL3 + BcUrl.SEND_HASH,
request,
BcHash.class
);
case 4:
return new RestTemplate().postForObject(
BLOCK_CHAIN_URL4 + BcUrl.SEND_HASH,
request,
BcHash.class
);
case 5:
return new RestTemplate().postForObject(
BLOCK_CHAIN_URL5 + BcUrl.SEND_HASH,
request,
BcHash.class
);
}
return new RestTemplate().postForObject(
BLOCK_CHAIN_URL + BcUrl.SEND_HASH,
request,
BcHash.class
);
} }
@Override @Override
...@@ -154,11 +192,11 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -154,11 +192,11 @@ public class BlockChainUtilImpl implements BlockChainUtil {
log.info("apiSignature:{}",s); log.info("apiSignature:{}",s);
request.put("apiSignature", s); request.put("apiSignature", s);
return new BcHash().toDate(); return new RestTemplate().postForObject(
// } BLOCK_CHAIN_URL + BcUrl.SEND_HASH,
// else { request,
// return new BcHash(0, "", new BcHashData("000")); BcHash.class
// } );
} }
@Override @Override
...@@ -179,6 +217,7 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -179,6 +217,7 @@ public class BlockChainUtilImpl implements BlockChainUtil {
SortedMap<Object, Object> request = getRequest(); SortedMap<Object, Object> request = getRequest();
map.forEach(request::put); map.forEach(request::put);
request.put("apiSignature", ApiSignatureUtil.getApiSignature(request, SECRET_KEY)); request.put("apiSignature", ApiSignatureUtil.getApiSignature(request, SECRET_KEY));
return new RestTemplate().postForObject( return new RestTemplate().postForObject(
BLOCK_CHAIN_URL + BcUrl.FETCH_HISTORY, BLOCK_CHAIN_URL + BcUrl.FETCH_HISTORY,
request, request,
...@@ -195,40 +234,40 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -195,40 +234,40 @@ public class BlockChainUtilImpl implements BlockChainUtil {
request.put("apiSignature", s); request.put("apiSignature", s);
// switch (index){ switch (index){
// case 1: case 1:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL + BcUrl.APPEND_TEXT, BLOCK_CHAIN_URL + BcUrl.APPEND_TEXT,
// request, request,
// BcText.class); BcText.class);
// case 2: case 2:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL2 + BcUrl.APPEND_TEXT, BLOCK_CHAIN_URL2 + BcUrl.APPEND_TEXT,
// request, request,
// BcText.class); BcText.class);
// case 3: case 3:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL3 + BcUrl.APPEND_TEXT, BLOCK_CHAIN_URL3 + BcUrl.APPEND_TEXT,
// request, request,
// BcText.class); BcText.class);
// case 4: case 4:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL4 + BcUrl.APPEND_TEXT, BLOCK_CHAIN_URL4 + BcUrl.APPEND_TEXT,
// request, request,
// BcText.class); BcText.class);
// case 5: case 5:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL5 + BcUrl.APPEND_TEXT, BLOCK_CHAIN_URL5 + BcUrl.APPEND_TEXT,
// request, request,
// BcText.class); BcText.class);
// } }
//
//
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL + BcUrl.APPEND_TEXT, BLOCK_CHAIN_URL + BcUrl.APPEND_TEXT,
// request, request,
// BcText.class); BcText.class);
return new BcText().toData(); // return new BcText().toData();
} }
@Override @Override
...@@ -239,7 +278,10 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -239,7 +278,10 @@ public class BlockChainUtilImpl implements BlockChainUtil {
String s = ApiSignatureUtil.getApiSignature(request, SECRET_KEY); String s = ApiSignatureUtil.getApiSignature(request, SECRET_KEY);
request.put("apiSignature", s); request.put("apiSignature", s);
return new BcText().toData(); return new RestTemplate().postForObject(
BLOCK_CHAIN_URL + BcUrl.APPEND_TEXT,
request,
BcText.class);
} }
@Override @Override
...@@ -251,45 +293,45 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -251,45 +293,45 @@ public class BlockChainUtilImpl implements BlockChainUtil {
request.put("apiSignature", s); request.put("apiSignature", s);
// switch (index){ switch (index){
// case 1: case 1:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL + BcUrl.APPEND_HASH, BLOCK_CHAIN_URL + BcUrl.APPEND_HASH,
// request, request,
// BcHash.class BcHash.class
// ); );
// case 2: case 2:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL2 + BcUrl.APPEND_HASH, BLOCK_CHAIN_URL2 + BcUrl.APPEND_HASH,
// request, request,
// BcHash.class BcHash.class
// ); );
// case 3: case 3:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL3 + BcUrl.APPEND_HASH, BLOCK_CHAIN_URL3 + BcUrl.APPEND_HASH,
// request, request,
// BcHash.class BcHash.class
// ); );
// case 4: case 4:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL4 + BcUrl.APPEND_HASH, BLOCK_CHAIN_URL4 + BcUrl.APPEND_HASH,
// request, request,
// BcHash.class BcHash.class
// ); );
// case 5: case 5:
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL5 + BcUrl.APPEND_HASH, BLOCK_CHAIN_URL5 + BcUrl.APPEND_HASH,
// request, request,
// BcHash.class BcHash.class
// ); );
// } }
//
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL + BcUrl.APPEND_HASH, BLOCK_CHAIN_URL + BcUrl.APPEND_HASH,
// request, request,
// BcHash.class BcHash.class
// ); );
return new BcHash().toDate(); // return new BcHash().toDate();
} }
...@@ -301,12 +343,12 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -301,12 +343,12 @@ public class BlockChainUtilImpl implements BlockChainUtil {
String s = ApiSignatureUtil.getApiSignature(request, SECRET_KEY); String s = ApiSignatureUtil.getApiSignature(request, SECRET_KEY);
request.put("apiSignature", s); request.put("apiSignature", s);
// return new RestTemplate().postForObject( return new RestTemplate().postForObject(
// BLOCK_CHAIN_URL + BcUrl.APPEND_HASH, BLOCK_CHAIN_URL + BcUrl.APPEND_HASH,
// request, request,
// BcHash.class BcHash.class
// ); );
return new BcHash().toDate(); // return new BcHash().toDate();
} }
@Override @Override
......
package com.tykj.dev.union; //package com.tykj.dev.union;
//
import com.tykj.dev.device.allot.repository.AllotBackBillDao; //import com.tykj.dev.device.allot.repository.AllotBackBillDao;
import com.tykj.dev.device.allot.repository.AllotBillDao; //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.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill; //import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail; //import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao; //import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao; //import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; //import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.repair.repository.RepairBackBillDao; //import com.tykj.dev.device.repair.repository.RepairBackBillDao;
import com.tykj.dev.device.repair.repository.RepairBillDao; //import com.tykj.dev.device.repair.repository.RepairBillDao;
import com.tykj.dev.device.repair.repository.RepairDetailDao; //import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.repository.RepairSendBillDao; //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.RepairBackBill;
import com.tykj.dev.device.repair.subject.domin.RepairBill; //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.RepairDetail;
import com.tykj.dev.device.repair.subject.domin.RepairSendBill; //import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao; //import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill; //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.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.Units; //import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.util.AuthenticationUtils; //import com.tykj.dev.device.user.util.AuthenticationUtils;
import com.tykj.dev.device.user.util.UserUtils; //import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.device.usereport.repository.DeviceUseReportDao; //import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport; //import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import com.tykj.dev.misc.utils.SpringUtils; //import com.tykj.dev.misc.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner; //import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.DependsOn; //import org.springframework.context.annotation.DependsOn;
import org.springframework.core.annotation.Order; //import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; //import org.springframework.transaction.annotation.Transactional;
//
import javax.annotation.PostConstruct; //import javax.annotation.PostConstruct;
import javax.annotation.Resource; //import javax.annotation.Resource;
import java.util.Collections; //import java.util.Collections;
import java.util.List; //import java.util.List;
//
@Slf4j //@Slf4j
@Component //@Component
public class DataInit { //public class DataInit {
//
@Resource // @Resource
private UnitsDao unitsDao; // private UnitsDao unitsDao;
//
@Autowired // @Autowired
private AllotBillDao allotBillDao; // private AllotBillDao allotBillDao;
@Autowired // @Autowired
private AllotBackBillDao allotBackBillDao; // private AllotBackBillDao allotBackBillDao;
@Autowired // @Autowired
private RepairBackBillDao repairBackBillDao; // private RepairBackBillDao repairBackBillDao;
@Autowired // @Autowired
private RepairDetailDao repairDetailDao; // private RepairDetailDao repairDetailDao;
@Autowired // @Autowired
private RepairSendBillDao repairSendBillDao; // private RepairSendBillDao repairSendBillDao;
@Autowired // @Autowired
private RepairBillDao repairBillDao; // private RepairBillDao repairBillDao;
@Autowired // @Autowired
private SelfCheckBillDao selfCheckBillDao; // private SelfCheckBillDao selfCheckBillDao;
@Autowired // @Autowired
private DeviceUseReportDao deviceUseReportDao; // private DeviceUseReportDao deviceUseReportDao;
//
@Autowired // @Autowired
private MatchingDeviceLibraryDao matchingDeviceLibraryDao; // private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
//
@Autowired // @Autowired
private UserUtils userUtils; // private UserUtils userUtils;
//
@Autowired // @Autowired
private SpringUtils springUtils; // private SpringUtils springUtils;
//
@Autowired // @Autowired
private com.tykj.dev.device.user.util.AuthenticationUtils AuthenticationUtils; // private com.tykj.dev.device.user.util.AuthenticationUtils AuthenticationUtils;
//
private void initCheckDetailUnitName() { // private void initCheckDetailUnitName() {
// 对现有的数据补充unitId信息 // // 对现有的数据补充unitId信息
allotBillDao.findAll().forEach(this::saveModifyDetail1); // allotBillDao.findAll().forEach(this::saveModifyDetail1);
allotBackBillDao.findAll().forEach(this::saveModifyDetail2); // allotBackBillDao.findAll().forEach(this::saveModifyDetail2);
selfCheckBillDao.findAll().forEach(this::saveModifyDetail3); // selfCheckBillDao.findAll().forEach(this::saveModifyDetail3);
repairBillDao.findAll().forEach(this::saveModifyDetail4); // repairBillDao.findAll().forEach(this::saveModifyDetail4);
repairSendBillDao.findAll().forEach(this::saveModifyDetail5); // repairSendBillDao.findAll().forEach(this::saveModifyDetail5);
repairDetailDao.findAll().forEach(this::saveModifyDetail6); // repairDetailDao.findAll().forEach(this::saveModifyDetail6);
repairBackBillDao.findAll().forEach(this::saveModifyDetail7); // repairBackBillDao.findAll().forEach(this::saveModifyDetail7);
deviceUseReportDao.findAll().forEach(this::saveModifyDetail8); // deviceUseReportDao.findAll().forEach(this::saveModifyDetail8);
matchingDeviceLibraryDao.findAll().forEach(this::saveModifyDetail9); // matchingDeviceLibraryDao.findAll().forEach(this::saveModifyDetail9);
} // }
//
//
private void saveModifyDetail1(AllotBill allotBill) { // private void saveModifyDetail1(AllotBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit(); // String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit(); // String sendUnit = allotBill.getSendUnit();
//
Integer receiveUnitId = getUnitId(receiveUnit); // Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit); // Integer sendUnitId = getUnitId(sendUnit);
//
if (receiveUnitId != -1 && sendUnitId != -1) { // if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId); // allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId); // allotBill.setSendUnitId(sendUnitId);
log.info("[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // log.info("[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId); // sendUnit, receiveUnit,sendUnitId,receiveUnitId);
allotBillDao.save(allotBill); // allotBillDao.save(allotBill);
} // }
//
} // }
//
private void saveModifyDetail2(AllotBackBill allotBackBill) { // private void saveModifyDetail2(AllotBackBill allotBackBill) {
String receiveUnit = allotBackBill.getReceiveUnit(); // String receiveUnit = allotBackBill.getReceiveUnit();
String sendUnit = allotBackBill.getSendUnit(); // String sendUnit = allotBackBill.getSendUnit();
//
Integer receiveUnitId = getUnitId(receiveUnit); // Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit); // Integer sendUnitId = getUnitId(sendUnit);
//
if (receiveUnitId != -1 && sendUnitId != -1) { // if (receiveUnitId != -1 && sendUnitId != -1) {
allotBackBill.setReceiveUnitId(receiveUnitId); // allotBackBill.setReceiveUnitId(receiveUnitId);
allotBackBill.setSendUnitId(sendUnitId); // allotBackBill.setSendUnitId(sendUnitId);
log.info("[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // log.info("[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId); // sendUnit, receiveUnit,sendUnitId,receiveUnitId);
allotBackBillDao.save(allotBackBill); // allotBackBillDao.save(allotBackBill);
} // }
//
} // }
//
private void saveModifyDetail3(SelfCheckBill selfCheckBill) { // private void saveModifyDetail3(SelfCheckBill selfCheckBill) {
String receiveUnit = selfCheckBill.getCheckUnit(); // String receiveUnit = selfCheckBill.getCheckUnit();
Integer receiveUnitId = getUnitId(receiveUnit); // Integer receiveUnitId = getUnitId(receiveUnit);
if (receiveUnitId != -1) { // if (receiveUnitId != -1) {
selfCheckBill.setCheckUnitId(receiveUnitId); // selfCheckBill.setCheckUnitId(receiveUnitId);
log.info("[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}", // log.info("[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}",
receiveUnit,receiveUnitId); // receiveUnit,receiveUnitId);
selfCheckBillDao.save(selfCheckBill); // selfCheckBillDao.save(selfCheckBill);
} // }
//
} // }
//
private void saveModifyDetail4(RepairBill allotBill) { // private void saveModifyDetail4(RepairBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit(); // String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit(); // String sendUnit = allotBill.getSendUnit();
//
Integer receiveUnitId = getUnitId(receiveUnit); // Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit); // Integer sendUnitId = getUnitId(sendUnit);
//
if (receiveUnitId != -1 && sendUnitId != -1) { // if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId); // allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId); // allotBill.setSendUnitId(sendUnitId);
log.info("[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // log.info("[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId); // sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairBillDao.save(allotBill); // repairBillDao.save(allotBill);
} // }
//
} // }
//
private void saveModifyDetail5(RepairSendBill allotBill) { // private void saveModifyDetail5(RepairSendBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit(); // String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit(); // String sendUnit = allotBill.getSendUnit();
//
Integer receiveUnitId = getUnitId(receiveUnit); // Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit); // Integer sendUnitId = getUnitId(sendUnit);
//
if (receiveUnitId != -1 && sendUnitId != -1) { // if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId); // allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId); // allotBill.setSendUnitId(sendUnitId);
log.info("[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // log.info("[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId); // sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairSendBillDao.save(allotBill); // repairSendBillDao.save(allotBill);
} // }
//
} // }
//
private void saveModifyDetail6(RepairDetail allotBill) { // private void saveModifyDetail6(RepairDetail allotBill) {
String receiveUnit = allotBill.getLocationUnit(); // String receiveUnit = allotBill.getLocationUnit();
String sendUnit = allotBill.getOwnUnit(); // String sendUnit = allotBill.getOwnUnit();
//
Integer receiveUnitId = getUnitId(receiveUnit); // Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit); // Integer sendUnitId = getUnitId(sendUnit);
//
if (receiveUnitId != -1 && sendUnitId != -1) { // if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setLocationUnitId(receiveUnitId); // allotBill.setLocationUnitId(receiveUnitId);
allotBill.setOwnUnitId(sendUnitId); // allotBill.setOwnUnitId(sendUnitId);
log.info("[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // log.info("[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId); // sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairDetailDao.save(allotBill); // repairDetailDao.save(allotBill);
} // }
//
} // }
private void saveModifyDetail7(RepairBackBill allotBill) { // private void saveModifyDetail7(RepairBackBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit(); // String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit(); // String sendUnit = allotBill.getSendUnit();
//
Integer receiveUnitId = getUnitId(receiveUnit); // Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit); // Integer sendUnitId = getUnitId(sendUnit);
//
if (receiveUnitId != -1 && sendUnitId != -1) { // if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId); // allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId); // allotBill.setSendUnitId(sendUnitId);
log.info("[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // log.info("[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId); // sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairBackBillDao.save(allotBill); // repairBackBillDao.save(allotBill);
} // }
//
} // }
//
private void saveModifyDetail8(DeviceUseReport allotBill) { // private void saveModifyDetail8(DeviceUseReport allotBill) {
String receiveUnit = allotBill.getUnit(); // String receiveUnit = allotBill.getUnit();
Integer receiveUnitId = getUnitId(receiveUnit); // Integer receiveUnitId = getUnitId(receiveUnit);
if (receiveUnitId != -1 ) { // if (receiveUnitId != -1 ) {
allotBill.setUnitId(receiveUnitId); // allotBill.setUnitId(receiveUnitId);
log.info("[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}", // log.info("[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}",
receiveUnit,receiveUnitId); // receiveUnit,receiveUnitId);
deviceUseReportDao.save(allotBill); // deviceUseReportDao.save(allotBill);
} // }
//
} // }
//
private void saveModifyDetail9(MatchingDeviceLibrary matchingDeviceLibrary) { // private void saveModifyDetail9(MatchingDeviceLibrary matchingDeviceLibrary) {
String createUnit = matchingDeviceLibrary.getCreateUnit(); // String createUnit = matchingDeviceLibrary.getCreateUnit();
Integer createUnitId = getUnitId(createUnit); // Integer createUnitId = getUnitId(createUnit);
if (createUnitId != -1 ) { // if (createUnitId != -1 ) {
matchingDeviceLibrary.setCreateUnitId(createUnitId); // matchingDeviceLibrary.setCreateUnitId(createUnitId);
log.info("[配套设备库] 修正MatchingDeviceLibrary历史数据,修正的单位:{},接收单位id:{}", // log.info("[配套设备库] 修正MatchingDeviceLibrary历史数据,修正的单位:{},接收单位id:{}",
createUnit,createUnitId); // createUnit,createUnitId);
matchingDeviceLibraryDao.save(matchingDeviceLibrary); // matchingDeviceLibraryDao.save(matchingDeviceLibrary);
} // }
//
} // }
//
private Integer getUnitId(String unitName) { // private Integer getUnitId(String unitName) {
List<Units> units = unitsDao.findAllByName(unitName).orElse(Collections.emptyList()); // List<Units> units = unitsDao.findAllByName(unitName).orElse(Collections.emptyList());
return units.size() == 1 ? units.get(0).getUnitId() : -1; // return units.size() == 1 ? units.get(0).getUnitId() : -1;
} // }
//
// @Bean //// @Bean
// @DependsOn("userUtils") //// @DependsOn("userUtils")
@PostConstruct // @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("单位名称初始化-----"); // log.info("单位名称初始化-----");
// initCheckDetailUnitName(); // 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();
//// }
//}
package com.tykj.dev.union; //package com.tykj.dev.union;
//
/** ///**
* @author zjm // * @author zjm
* @version 1.0.0 // * @version 1.0.0
* @ClassName AreaController.java // * @ClassName AreaController.java
* @Description TODO // * @Description TODO
* @createTime 2020年09月04日 13:34:00 // * @createTime 2020年09月04日 13:34:00
*/ // */
//
import com.tykj.dev.config.swagger.AutoDocument; //import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.user.subject.dao.AreaDao; //import com.tykj.dev.device.user.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.entity.Area; //import com.tykj.dev.device.user.subject.entity.Area;
import com.tykj.dev.device.user.subject.entity.SecurityUser; //import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.service.AreaService; //import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.misc.exception.ApiException; //import com.tykj.dev.misc.exception.ApiException;
import io.swagger.annotations.Api; //import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; //import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; //import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal; //import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*; //import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; //import springfox.documentation.annotations.ApiIgnore;
//
import java.util.Optional; //import java.util.Optional;
//
/** ///**
* 区域视图层 // * 区域视图层
*/ // */
@RestController //@RestController
@RequestMapping("/run") //@RequestMapping("/run")
public class RunController { //public class RunController {
@Autowired // @Autowired
DataInit dataInit; // DataInit dataInit;
@GetMapping(value = "/init2") // @GetMapping(value = "/init2")
public ResponseEntity addPermissions(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) { // public ResponseEntity addPermissions(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
dataInit.init2(); // dataInit.init2();
return ResponseEntity.ok("ok"); // return ResponseEntity.ok("ok");
} // }
//
//
} //}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论