|
|
|
|
@ -431,12 +431,17 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String upgrade(Long instrumentId) {
|
|
|
|
|
public String upgrade(Long instrumentId, Boolean isWe200) {
|
|
|
|
|
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(instrumentId);
|
|
|
|
|
if (wxInstrument != null && StringUtils.isNotBlank(wxInstrument.getIotUpgradeData())) {
|
|
|
|
|
// 读取文件系统中的文件
|
|
|
|
|
try {
|
|
|
|
|
byte[] byteArray = FileCopyUtils.copyToByteArray(new URL(wxInstrument.getIotUpgradeData()).openStream());
|
|
|
|
|
byte[] byteArray;
|
|
|
|
|
if (isWe200) {
|
|
|
|
|
byteArray = FileCopyUtils.copyToByteArray(new URL(wxInstrument.getWe200IotUpgradeData()).openStream());
|
|
|
|
|
} else {
|
|
|
|
|
byteArray = FileCopyUtils.copyToByteArray(new URL(wxInstrument.getIotUpgradeData()).openStream());
|
|
|
|
|
}
|
|
|
|
|
return DatatypeConverter.printHexBinary(byteArray);
|
|
|
|
|
} catch (FileNotFoundException e) {
|
|
|
|
|
logger.error("instrumentId:{} 升级失败: {}", instrumentId, e.getMessage());
|
|
|
|
|
|