批量新增设备bug修改
This commit is contained in:
@@ -257,7 +257,18 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping(value = "importEquipment")
|
||||
public HttpResult<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importEquipment");
|
||||
csEquipmentDeliveryService.importEquipment(file, response);
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.importEquipment(file, response);
|
||||
if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)){
|
||||
csEquipmentDeliveryPOS.forEach(temp->{
|
||||
//查询mqtt用户名和密码是否存在
|
||||
boolean result = mqttUserService.findMqttUser(temp.getNdid());
|
||||
if (result){
|
||||
//初始化装置mqtt连接信息(使用sha256加密)
|
||||
mqttUserService.insertMqttUser(temp.getNdid());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
@ResponseBody
|
||||
|
||||
@@ -99,7 +99,7 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
*/
|
||||
CsEquipmentDeliveryPO findDevByNDid(String nDid);
|
||||
|
||||
void importEquipment(MultipartFile file, HttpServletResponse response);
|
||||
List<CsEquipmentDeliveryPO> importEquipment(MultipartFile file, HttpServletResponse response);
|
||||
|
||||
void delete(String devId);
|
||||
|
||||
|
||||
@@ -446,7 +446,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importEquipment(MultipartFile file, HttpServletResponse response) {
|
||||
public List<CsEquipmentDeliveryPO> importEquipment(MultipartFile file, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams ( );
|
||||
params.setHeadRows(1);
|
||||
params.setTitleRows(1);
|
||||
@@ -548,27 +548,20 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}).collect (Collectors.toList ( ));
|
||||
csEquipmentProcessPOService.saveBatch(collect1,500);
|
||||
this.saveOrUpdateBatch (collect, 500);
|
||||
collect.forEach(temp->{
|
||||
if (Objects.nonNull(temp)){
|
||||
//查询mqtt用户名和密码是否存在
|
||||
boolean result = mqttUserService.findMqttUser(temp.getNdid());
|
||||
if (result){
|
||||
//初始化装置mqtt连接信息(使用sha256加密)
|
||||
mqttUserService.insertMqttUser(temp.getNdid());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return collect;
|
||||
}
|
||||
if (!CollectionUtils.isEmpty (falseCollect)) {
|
||||
ExportParams exportExcel = new ExportParams ("批量导入模板(请严格按照模板标准填入数据)", "非法设备信息");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel (exportExcel, DeviceExcelTemplete.IllegalityDeviceExcelTemplete.class, falseCollect);
|
||||
ExcelStyleUtil.exportFileByWorkbook (workbook, "非法设备信息.xlsx", response);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace ( );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/*
|
||||
* 物理删除设备相关数据
|
||||
|
||||
Reference in New Issue
Block a user