|
@@ -1511,9 +1511,17 @@ public class FxController extends BaseController {
|
|
//-------------开始解析文件----------------
|
|
//-------------开始解析文件----------------
|
|
List<Device> devices=ExcelUtils.readDeviceFile(new File( PropertiesUtil.getValue("file_save_path")+fileInfos.get(0).getFilePath()));
|
|
List<Device> devices=ExcelUtils.readDeviceFile(new File( PropertiesUtil.getValue("file_save_path")+fileInfos.get(0).getFilePath()));
|
|
String batchCode=DateHelper.format(new Date(), "yyyyMMddHHmmssSS");
|
|
String batchCode=DateHelper.format(new Date(), "yyyyMMddHHmmssSS");
|
|
|
|
+ List<DeviceAct> list = new ArrayList<>();
|
|
|
|
+ Merchant merchant= null;
|
|
for (Device device : devices) {
|
|
for (Device device : devices) {
|
|
if(StringUtils.isNotEmpty(device.getPosCode())){
|
|
if(StringUtils.isNotEmpty(device.getPosCode())){
|
|
- Merchant merchant=merchantService.getMerchantByPosCode(device.getPosCode());
|
|
|
|
|
|
+ if(merchant ==null){
|
|
|
|
+ merchant=merchantService.getMerchantByPosCode(device.getPosCode());
|
|
|
|
+ }else{
|
|
|
|
+ if(!device.isLastPosCode()){
|
|
|
|
+ merchant=merchantService.getMerchantByPosCode(device.getPosCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
device.setMerchantId(merchant.getId());
|
|
device.setMerchantId(merchant.getId());
|
|
device.setOrgCode(merchant.getOrgCode());
|
|
device.setOrgCode(merchant.getOrgCode());
|
|
device.setStatus(1);
|
|
device.setStatus(1);
|
|
@@ -1530,7 +1538,8 @@ public class FxController extends BaseController {
|
|
deviceAct.setRemarks("设备入库:导入入库");
|
|
deviceAct.setRemarks("设备入库:导入入库");
|
|
deviceAct.setBatchCode(batchCode);
|
|
deviceAct.setBatchCode(batchCode);
|
|
deviceAct.setType(3);
|
|
deviceAct.setType(3);
|
|
- deviceActService.save(deviceAct);
|
|
|
|
|
|
+ list.add(deviceAct);
|
|
|
|
+
|
|
|
|
|
|
ConchDerver conchDerver=conchDerverService.getConchDerverByImei(device.getImei());
|
|
ConchDerver conchDerver=conchDerverService.getConchDerverByImei(device.getImei());
|
|
if(conchDerver!=null){
|
|
if(conchDerver!=null){
|
|
@@ -1542,10 +1551,9 @@ public class FxController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ deviceActService.save(list);
|
|
deviceService.save(devices);
|
|
deviceService.save(devices);
|
|
//-------------结束解析文件----------------
|
|
//-------------结束解析文件----------------
|
|
-
|
|
|
|
responseEntity.success(data, "上传文件成功 ");
|
|
responseEntity.success(data, "上传文件成功 ");
|
|
} else {
|
|
} else {
|
|
responseEntity.failure(ResponseConstant.CODE_000, "上传文件失败");
|
|
responseEntity.failure(ResponseConstant.CODE_000, "上传文件失败");
|