Commit 53052611 authored by wanghao's avatar wanghao

1 液化石油气监管-气瓶档案导入-功能开发, 涉及到实体类解析报错问题处理.

parent a40e906b
package com.zehong.web.controller.lpgRegulation;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import java.util.Map;
import com.zehong.system.domain.TLpgAirChargeFiles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -19,6 +21,9 @@ import com.zehong.system.domain.TLpgGasBottleFiles;
import com.zehong.system.service.ITLpgGasBottleFilesService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* 液化石油气-气瓶档案Controller
......@@ -94,4 +99,33 @@ public class TLpgGasBottleFilesController extends BaseController
{
return toAjax(tLpgGasBottleFilesService.deleteTLpgGasBottleFilesByIds(fGasBottleFilesIds));
}
/**
* 模版下载
* @return r
*/
@GetMapping("/importTemplate")
public AjaxResult importTemplate(){
ExcelUtil<TLpgGasBottleFiles> util = new ExcelUtil<>(TLpgGasBottleFiles.class);
return util.importTemplateExcel("气瓶档案数据");
}
/**
* 文件导入
* @param file f
* @param updateSupport u
* @return r
* @throws Exception r
*/
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport, HttpServletResponse response) throws Exception
{
ExcelUtil<TLpgGasBottleFiles> util = new ExcelUtil<>(TLpgGasBottleFiles.class);
List<TLpgGasBottleFiles> XmbhList = util.importExcel(file.getInputStream());
Map<String, Object> map = tLpgGasBottleFilesService.importLpgGasBottleFilesInfo(XmbhList, updateSupport, response);
return AjaxResult.success(map);
}
}
package com.zehong.system.service;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TLpgGasBottleFiles;
import javax.servlet.http.HttpServletResponse;
/**
* 液化石油气-气瓶档案Service接口
*
......@@ -58,4 +62,14 @@ public interface ITLpgGasBottleFilesService
* @return 结果
*/
public int deleteTLpgGasBottleFilesById(Long fGasBottleFilesId);
/**
* 导入
* @param xmbhList data
* @param updateSupport 是否更新
* @param response res
* @return r
*/
public Map<String,Object> importLpgGasBottleFilesInfo(List<TLpgGasBottleFiles> xmbhList, boolean updateSupport, HttpServletResponse response);
}
......@@ -152,7 +152,7 @@ public class TLpgAirChargeFilesServiceImpl implements ITLpgAirChargeFilesService
// 这是 上面气瓶条码 有的气瓶数据
List<TLpgGasBottleFiles> tLpgGasBottleFiles2 = tLpgGasBottleFilesMapper.queryAllByFQRcodeList(collect);
// 按照 气瓶条码 分组
Map<String, List<TLpgGasBottleFiles>> collect1 = tLpgGasBottleFiles2.stream().collect(Collectors.groupingBy(TLpgGasBottleFiles::getfQRcode));
Map<String, List<TLpgGasBottleFiles>> collect1 = tLpgGasBottleFiles2.stream().collect(Collectors.groupingBy(TLpgGasBottleFiles::getqRcode));
errorNum += noBarCodeList.size();
......
......@@ -98,13 +98,13 @@ public class TLpgDeliveryRecordServiceImpl implements ITLpgDeliveryRecordService
// 气瓶条码处理
TLpgGasBottleFiles tLpgGasBottleFiles = new TLpgGasBottleFiles();
tLpgGasBottleFiles.setfQRcode(tLpgDeliveryRecordImportVo.getBottleCode());
tLpgGasBottleFiles.setqRcode(tLpgDeliveryRecordImportVo.getBottleCode());
List<TLpgGasBottleFiles> tLpgGasBottleFiles1 = tLpgGasBottleFilesMapper.selectTLpgGasBottleFilesList(tLpgGasBottleFiles);
if (tLpgGasBottleFiles1 == null || tLpgGasBottleFiles1.size() == 0) {
errorNum ++;
continue;
}
lpgDeliveryRecord.setBottleCode(tLpgGasBottleFiles1.get(0).getfQRcode());
lpgDeliveryRecord.setBottleCode(tLpgGasBottleFiles1.get(0).getqRcode());
// 燃气用户处理
......
package com.zehong.system.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TLpgGasBottleFilesMapper;
import com.zehong.system.domain.TLpgGasBottleFiles;
import com.zehong.system.service.ITLpgGasBottleFilesService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/**
* 液化石油气-气瓶档案Service业务层处理
*
......@@ -16,7 +21,7 @@ import com.zehong.system.service.ITLpgGasBottleFilesService;
@Service
public class TLpgGasBottleFilesServiceImpl implements ITLpgGasBottleFilesService
{
@Autowired
@Resource
private TLpgGasBottleFilesMapper tLpgGasBottleFilesMapper;
/**
......@@ -90,4 +95,21 @@ public class TLpgGasBottleFilesServiceImpl implements ITLpgGasBottleFilesService
{
return tLpgGasBottleFilesMapper.deleteTLpgGasBottleFilesById(fGasBottleFilesId);
}
/**
* 气瓶档案导入
* @param xmbhList data
* @param updateSupport 是否更新
* @param response res
* @return r
*/
@Override
public Map<String, Object> importLpgGasBottleFilesInfo(List<TLpgGasBottleFiles> xmbhList, boolean updateSupport, HttpServletResponse response) {
for (TLpgGasBottleFiles tLpgGasBottleFiles : xmbhList) {
System.out.println(tLpgGasBottleFiles.getqRcode());
}
return null;
}
}
......@@ -51,3 +51,12 @@ export function exportFiles(query) {
params: query
})
}
// 下载用户导入模板
export function importTemplate() {
return request({
url: '/lpg/gasbottlefiles/importTemplate',
method: 'get'
})
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment