Commit 65ae33b4 authored by wanghao's avatar wanghao

1 液化石油气监管-充装记录导入-功能开发中

parent 95d73b3e
package com.zehong.web.controller.lpgRegulation; package com.zehong.web.controller.lpgRegulation;
import java.util.List; import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -19,6 +19,9 @@ import com.zehong.system.domain.TLpgAirChargeFiles; ...@@ -19,6 +19,9 @@ import com.zehong.system.domain.TLpgAirChargeFiles;
import com.zehong.system.service.ITLpgAirChargeFilesService; import com.zehong.system.service.ITLpgAirChargeFilesService;
import com.zehong.common.utils.poi.ExcelUtil; import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo; import com.zehong.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/** /**
* 液化石油气-充装记录Controller * 液化石油气-充装记录Controller
...@@ -51,7 +54,7 @@ public class TLpgAirChargeFilesController extends BaseController ...@@ -51,7 +54,7 @@ public class TLpgAirChargeFilesController extends BaseController
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(TLpgAirChargeFiles tLpgAirChargeFiles) public AjaxResult export(TLpgAirChargeFiles tLpgAirChargeFiles)
{ {
List<TLpgAirChargeFiles> list = tLpgAirChargeFilesService.selectTLpgAirChargeFilesList(tLpgAirChargeFiles); List<TLpgAirChargeFiles> list = tLpgAirChargeFilesService.queryAllForExport(tLpgAirChargeFiles);
ExcelUtil<TLpgAirChargeFiles> util = new ExcelUtil<TLpgAirChargeFiles>(TLpgAirChargeFiles.class); ExcelUtil<TLpgAirChargeFiles> util = new ExcelUtil<TLpgAirChargeFiles>(TLpgAirChargeFiles.class);
return util.exportExcel(list, "液化石油气-充装记录数据"); return util.exportExcel(list, "液化石油气-充装记录数据");
} }
...@@ -94,4 +97,34 @@ public class TLpgAirChargeFilesController extends BaseController ...@@ -94,4 +97,34 @@ public class TLpgAirChargeFilesController extends BaseController
{ {
return toAjax(tLpgAirChargeFilesService.deleteTLpgAirChargeFilesByIds(fGasAirChargeIds)); return toAjax(tLpgAirChargeFilesService.deleteTLpgAirChargeFilesByIds(fGasAirChargeIds));
} }
/**
* 模版下载
* @return r
*/
@GetMapping("/importTemplate")
public AjaxResult importTemplate(){
ExcelUtil<TLpgAirChargeFiles> util = new ExcelUtil<>(TLpgAirChargeFiles.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<TLpgAirChargeFiles> util = new ExcelUtil<>(TLpgAirChargeFiles.class);
List<TLpgAirChargeFiles> XmbhList = util.importExcel(file.getInputStream());
tLpgAirChargeFilesService.importLpgAirChargeFileInfo(XmbhList, updateSupport, response);
return AjaxResult.success();
}
} }
...@@ -70,133 +70,118 @@ public class TLpgAirChargeFiles extends BaseEntity ...@@ -70,133 +70,118 @@ public class TLpgAirChargeFiles extends BaseEntity
@Excel(name = "充装工") @Excel(name = "充装工")
private String fOprateName; private String fOprateName;
public void setfGasAirChargeId(Long fGasAirChargeId) public Long getfGasAirChargeId() {
{
this.fGasAirChargeId = fGasAirChargeId;
}
public Long getfGasAirChargeId()
{
return fGasAirChargeId; return fGasAirChargeId;
} }
public void setfGzId(Long fGzId)
{ public void setfGasAirChargeId(Long fGasAirChargeId) {
this.fGzId = fGzId; this.fGasAirChargeId = fGasAirChargeId;
} }
public Long getfGzId() public Long getfGzId() {
{
return fGzId; return fGzId;
} }
public void setfStationName(String fStationName)
{ public void setfGzId(Long fGzId) {
this.fStationName = fStationName; this.fGzId = fGzId;
} }
public String getfStationName() public String getfStationName() {
{
return fStationName; return fStationName;
} }
public void setfBarCode(String fBarCode)
{ public void setfStationName(String fStationName) {
this.fBarCode = fBarCode; this.fStationName = fStationName;
} }
public String getfBarCode() public String getfBarCode() {
{
return fBarCode; return fBarCode;
} }
public void setfVaseCode(String fVaseCode)
{ public void setfBarCode(String fBarCode) {
this.fVaseCode = fVaseCode; this.fBarCode = fBarCode;
} }
public String getfVaseCode() public String getfVaseCode() {
{
return fVaseCode; return fVaseCode;
} }
public void setfScaleNum(String fScaleNum)
{ public void setfVaseCode(String fVaseCode) {
this.fScaleNum = fScaleNum; this.fVaseCode = fVaseCode;
} }
public String getfScaleNum() public String getfScaleNum() {
{
return fScaleNum; return fScaleNum;
} }
public void setfFillStatrTime(String fFillStatrTime)
{ public void setfScaleNum(String fScaleNum) {
this.fFillStatrTime = fFillStatrTime; this.fScaleNum = fScaleNum;
} }
public String getfFillStatrTime() public String getfFillStatrTime() {
{
return fFillStatrTime; return fFillStatrTime;
} }
public void setfFillEndTime(String fFillEndTime)
{ public void setfFillStatrTime(String fFillStatrTime) {
this.fFillEndTime = fFillEndTime; this.fFillStatrTime = fFillStatrTime;
} }
public String getfFillEndTime() public String getfFillEndTime() {
{
return fFillEndTime; return fFillEndTime;
} }
public void setfSetWeight(String fSetWeight)
{ public void setfFillEndTime(String fFillEndTime) {
this.fSetWeight = fSetWeight; this.fFillEndTime = fFillEndTime;
} }
public String getfSetWeight() public String getfSetWeight() {
{
return fSetWeight; return fSetWeight;
} }
public void setfWtNet(String fWtNet)
{ public void setfSetWeight(String fSetWeight) {
this.fWtNet = fWtNet; this.fSetWeight = fSetWeight;
} }
public String getfWtNet() public String getfWtNet() {
{
return fWtNet; return fWtNet;
} }
public void setfSetBottleWeight(String fSetBottleWeight)
{ public void setfWtNet(String fWtNet) {
this.fSetBottleWeight = fSetBottleWeight; this.fWtNet = fWtNet;
} }
public String getfSetBottleWeight() public String getfSetBottleWeight() {
{
return fSetBottleWeight; return fSetBottleWeight;
} }
public void setfBottleWeight(String fBottleWeight)
{ public void setfSetBottleWeight(String fSetBottleWeight) {
this.fBottleWeight = fBottleWeight; this.fSetBottleWeight = fSetBottleWeight;
} }
public String getfBottleWeight() public String getfBottleWeight() {
{
return fBottleWeight; return fBottleWeight;
} }
public void setfWtGross(String fWtGross)
{ public void setfBottleWeight(String fBottleWeight) {
this.fWtGross = fWtGross; this.fBottleWeight = fBottleWeight;
} }
public String getfWtGross() public String getfWtGross() {
{
return fWtGross; return fWtGross;
} }
public void setfOprateName(String fOprateName)
{ public void setfWtGross(String fWtGross) {
this.fOprateName = fOprateName; this.fWtGross = fWtGross;
} }
public String getfOprateName() public String getfOprateName() {
{
return fOprateName; return fOprateName;
} }
public void setfOprateName(String fOprateName) {
this.fOprateName = fOprateName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -29,6 +29,13 @@ public interface TLpgAirChargeFilesMapper ...@@ -29,6 +29,13 @@ public interface TLpgAirChargeFilesMapper
*/ */
public List<TLpgAirChargeFiles> selectTLpgAirChargeFilesList(TLpgAirChargeFiles tLpgAirChargeFiles); public List<TLpgAirChargeFiles> selectTLpgAirChargeFilesList(TLpgAirChargeFiles tLpgAirChargeFiles);
/**
* 2024-09-12 wh 查询数据为了导出用 限制导出数量
* @param tLpgAirChargeFiles t
* @return r
*/
public List<TLpgAirChargeFiles> queryAllForExport(TLpgAirChargeFiles tLpgAirChargeFiles);
/** /**
* 新增液化石油气-充装记录 * 新增液化石油气-充装记录
* *
......
package com.zehong.system.service; package com.zehong.system.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TLpgAirChargeFiles; import com.zehong.system.domain.TLpgAirChargeFiles;
import com.zehong.system.domain.TLpgVehicleInfo;
import javax.servlet.http.HttpServletResponse;
/** /**
* 液化石油气-充装记录Service接口 * 液化石油气-充装记录Service接口
...@@ -29,6 +34,14 @@ public interface ITLpgAirChargeFilesService ...@@ -29,6 +34,14 @@ public interface ITLpgAirChargeFilesService
*/ */
public List<TLpgAirChargeFiles> selectTLpgAirChargeFilesList(TLpgAirChargeFiles tLpgAirChargeFiles); public List<TLpgAirChargeFiles> selectTLpgAirChargeFilesList(TLpgAirChargeFiles tLpgAirChargeFiles);
/**
* 2024-09-12 wh 查询数据为了导出用 限制导出数量
* @param tLpgAirChargeFiles t
* @return r
*/
public List<TLpgAirChargeFiles> queryAllForExport(TLpgAirChargeFiles tLpgAirChargeFiles);
/** /**
* 新增液化石油气-充装记录 * 新增液化石油气-充装记录
* *
...@@ -60,4 +73,14 @@ public interface ITLpgAirChargeFilesService ...@@ -60,4 +73,14 @@ public interface ITLpgAirChargeFilesService
* @return 结果 * @return 结果
*/ */
public int deleteTLpgAirChargeFilesById(Long fGasAirChargeId); public int deleteTLpgAirChargeFilesById(Long fGasAirChargeId);
/**
* 导入
* @param xmbhList data
* @param updateSupport 是否更新
* @param response res
* @return r
*/
public Map<String,Object> importLpgAirChargeFileInfo(List<TLpgAirChargeFiles> xmbhList, boolean updateSupport, HttpServletResponse response);
} }
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TLpgAirChargeFilesMapper; import com.zehong.system.mapper.TLpgAirChargeFilesMapper;
import com.zehong.system.domain.TLpgAirChargeFiles; import com.zehong.system.domain.TLpgAirChargeFiles;
import com.zehong.system.service.ITLpgAirChargeFilesService; import com.zehong.system.service.ITLpgAirChargeFilesService;
import javax.servlet.http.HttpServletResponse;
/** /**
* 液化石油气-充装记录Service业务层处理 * 液化石油气-充装记录Service业务层处理
* *
...@@ -50,6 +55,16 @@ public class TLpgAirChargeFilesServiceImpl implements ITLpgAirChargeFilesService ...@@ -50,6 +55,16 @@ public class TLpgAirChargeFilesServiceImpl implements ITLpgAirChargeFilesService
return tLpgAirChargeFilesMapper.selectTLpgAirChargeFilesList(tLpgAirChargeFiles); return tLpgAirChargeFilesMapper.selectTLpgAirChargeFilesList(tLpgAirChargeFiles);
} }
/**
* 2024-09-12 wh 查询数据为了导出用 限制导出数量
* @param tLpgAirChargeFiles t
* @return r
*/
@Override
public List<TLpgAirChargeFiles> queryAllForExport(TLpgAirChargeFiles tLpgAirChargeFiles) {
return tLpgAirChargeFilesMapper.queryAllForExport(tLpgAirChargeFiles);
}
/** /**
* 新增液化石油气-充装记录 * 新增液化石油气-充装记录
* *
...@@ -97,4 +112,23 @@ public class TLpgAirChargeFilesServiceImpl implements ITLpgAirChargeFilesService ...@@ -97,4 +112,23 @@ public class TLpgAirChargeFilesServiceImpl implements ITLpgAirChargeFilesService
{ {
return tLpgAirChargeFilesMapper.deleteTLpgAirChargeFilesById(fGasAirChargeId); return tLpgAirChargeFilesMapper.deleteTLpgAirChargeFilesById(fGasAirChargeId);
} }
/**
* 导出
* @param xmbhList data
* @param updateSupport 是否更新
* @param response res
*/
@Override
public Map<String,Object> importLpgAirChargeFileInfo(List<TLpgAirChargeFiles> xmbhList, boolean updateSupport, HttpServletResponse response) {
Map<String ,Object> map = new HashMap<>();
for (TLpgAirChargeFiles tLpgAirChargeFiles : xmbhList) {
System.out.println(tLpgAirChargeFiles.getfBarCode());
}
return map;
}
} }
...@@ -32,7 +32,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -32,7 +32,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fBarCode != null and fBarCode != ''"> and f_bar_code like concat('%', #{fBarCode}, '%') </if> <if test="fBarCode != null and fBarCode != ''"> and f_bar_code like concat('%', #{fBarCode}, '%') </if>
</where> </where>
</select> </select>
<select id="queryAllForExport" resultMap="TLpgAirChargeFilesResult">
<include refid="selectTLpgAirChargeFilesVo"/>
<where>
<if test="fVaseCode != null and fVaseCode != ''"> and f_vase_code like concat('%', #{fVaseCode}, '%') </if>
<if test="fBarCode != null and fBarCode != ''"> and f_bar_code like concat('%', #{fBarCode}, '%') </if>
</where>
limit 1000
</select>
<select id="selectTLpgAirChargeFilesById" parameterType="Long" resultMap="TLpgAirChargeFilesResult"> <select id="selectTLpgAirChargeFilesById" parameterType="Long" resultMap="TLpgAirChargeFilesResult">
<include refid="selectTLpgAirChargeFilesVo"/> <include refid="selectTLpgAirChargeFilesVo"/>
where f_gas_air_charge_id = #{fGasAirChargeId} where f_gas_air_charge_id = #{fGasAirChargeId}
......
...@@ -51,3 +51,11 @@ export function exportFiles(query) { ...@@ -51,3 +51,11 @@ export function exportFiles(query) {
params: query params: query
}) })
} }
// 下载用户导入模板
export function importTemplate() {
return request({
url: '/lpg/airchargefiles/importTemplate',
method: 'get'
})
}
\ No newline at end of file
...@@ -36,6 +36,15 @@ ...@@ -36,6 +36,15 @@
@click="handleExport" @click="handleExport"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImport">导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
...@@ -68,12 +77,44 @@ ...@@ -68,12 +77,44 @@
<!-- 详情 --> <!-- 详情 -->
<DetailInfo ref="detail"/> <DetailInfo ref="detail"/>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
<br>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listFiles, exportFiles } from "@/api/lpgRegulation/airchargefiles"; import { listFiles, exportFiles,importTemplate } from "@/api/lpgRegulation/airchargefiles";
import DetailInfo from "./components/indexInfo"; import DetailInfo from "./components/indexInfo";
import { getToken } from "@/utils/auth";
export default { export default {
name: "Files", name: "Files",
...@@ -82,6 +123,22 @@ export default { ...@@ -82,6 +123,22 @@ export default {
}, },
data() { data() {
return { return {
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/lpg/airchargefiles/importData"
},
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 导出遮罩层 // 导出遮罩层
...@@ -119,6 +176,38 @@ export default { ...@@ -119,6 +176,38 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
this.download(response.msg);
});
},
handleImport(){
this.upload.title = "充装记录导入"; // todo
this.upload.open = true;
},
// 文件上传处理中
handleFileUploadProgress(event,file,fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
/** 查询液化石油气-充装记录列表 */ /** 查询液化石油气-充装记录列表 */
getList() { getList() {
this.loading = true; this.loading = true;
......
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