|
@@ -1512,9 +1512,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);
|
|
@@ -1531,7 +1539,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){
|
|
@@ -1543,10 +1552,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, "上传文件失败");
|