Commit 30eaf855 authored by 陈明豪's avatar 陈明豪

核酸采集和隔离点人员的导出空模板,导入功能

parent 4c70d55c
...@@ -56,22 +56,18 @@ public class GldryController extends BaseController ...@@ -56,22 +56,18 @@ public class GldryController extends BaseController
} }
@Log(title = "导出隔离点人员导入空模板",businessType = BusinessType.EXPORT) @Log(title = "导出隔离点人员导入空模板",businessType = BusinessType.EXPORT)
@GetMapping("/exportTemplate") @GetMapping("/importTemplate")
public void exportTemplate(HttpServletResponse response){ public void exportTemplate(HttpServletResponse response){
ExcelUtil<Gldry> util = new ExcelUtil<Gldry>(Gldry.class); ExcelUtil<Gldry> util = new ExcelUtil<Gldry>(Gldry.class);
util.importTemplateExcel(response,"隔离点人员数据导入空模板"); util.importTemplateExcel(response,"隔离点人员数据导入空模板");
} }
@Log(title = "导入隔离点人员数据",businessType = BusinessType.EXPORT) @Log(title = "导入隔离点人员数据",businessType = BusinessType.EXPORT)
@PostMapping("/importGldryData") @PostMapping("/importData")
@ResponseBody public void importGldryData(MultipartFile file, HttpServletResponse response) throws Exception{
public AjaxResult importGldryData(MultipartFile file, HttpServletResponse response) throws Exception{
ExcelUtil<Gldry> util = new ExcelUtil<Gldry>(Gldry.class); ExcelUtil<Gldry> util = new ExcelUtil<Gldry>(Gldry.class);
List<Gldry> dataList = util.importExcel(file.getInputStream()); List<Gldry> dataList = util.importExcel(file.getInputStream());
gldryService.importList(dataList,response); gldryService.importList(dataList,response);
String message = "导入隔离点人员数据";
return AjaxResult.success(message);
} }
/** /**
......
...@@ -56,23 +56,19 @@ public class HscjController extends BaseController ...@@ -56,23 +56,19 @@ public class HscjController extends BaseController
} }
@Log(title = "导出核酸采集导入空模板",businessType = BusinessType.EXPORT) @Log(title = "导出核酸采集导入空模板",businessType = BusinessType.EXPORT)
@GetMapping("/exportTemplate") @GetMapping("/importTemplate")
public void exportTemplate(HttpServletResponse response){ public void exportTemplate(HttpServletResponse response){
ExcelUtil<Hscj> util = new ExcelUtil<Hscj>(Hscj.class); ExcelUtil<Hscj> util = new ExcelUtil<Hscj>(Hscj.class);
util.importTemplateExcel(response,"核酸采集导入空模板"); util.importTemplateExcel(response,"核酸采集导入空模板");
} }
@Log(title = "导入核算采集数据",businessType = BusinessType.EXPORT) @Log(title = "导入核算采集数据",businessType = BusinessType.EXPORT)
@PostMapping("/importHsjcData") @PostMapping("/importData")
@ResponseBody public void importHscjData(MultipartFile file,HttpServletResponse response) throws Exception{
public AjaxResult importHsjcData(MultipartFile file,HttpServletResponse response) throws Exception{
ExcelUtil<Hscj> util = new ExcelUtil<Hscj>(Hscj.class); ExcelUtil<Hscj> util = new ExcelUtil<Hscj>(Hscj.class);
List<Hscj> dataList = util.importExcel(file.getInputStream()); List<Hscj> dataList = util.importExcel(file.getInputStream());
System.out.println(dataList);
hscjService.importList(dataList,response); hscjService.importList(dataList,response);
String message = "导入核算采集数据";
return AjaxResult.success(message);
} }
/** /**
......
...@@ -3,12 +3,14 @@ package com.ruoyi.system.service.impl; ...@@ -3,12 +3,14 @@ package com.ruoyi.system.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.CheckUtils; import com.ruoyi.common.utils.CheckUtils;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Zlqk; import com.ruoyi.system.domain.Zlqk;
import com.ruoyi.system.mapper.SysDictDataMapper;
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.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
...@@ -30,6 +32,8 @@ public class HscjServiceImpl implements IHscjService ...@@ -30,6 +32,8 @@ public class HscjServiceImpl implements IHscjService
{ {
@Autowired @Autowired
private HscjMapper hscjMapper; private HscjMapper hscjMapper;
@Autowired
private SysDictDataMapper sysDictDataMapper;
/** /**
* 查询核酸采集 * 查询核酸采集
...@@ -146,6 +150,16 @@ public class HscjServiceImpl implements IHscjService ...@@ -146,6 +150,16 @@ public class HscjServiceImpl implements IHscjService
if (!hscjs.isEmpty()){ if (!hscjs.isEmpty()){
failureList.add(hscj); failureList.add(hscj);
}else { }else {
if (StringUtils.isNotEmpty(hscj.getStreet())){
List<SysDictData> dictDataList = sysDictDataMapper.selectDictDataByType("street_town");
String street = hscj.getStreet();
for (SysDictData sysDictData:dictDataList){
if (sysDictData.getDictLabel().equals(street)){
street = sysDictData.getDictValue();
}
}
hscj.setStreet(street);
}
if (CheckUtils.checkCard(hscj.getCardNo())){ if (CheckUtils.checkCard(hscj.getCardNo())){
if (hscj.getSex().equals("女")){ if (hscj.getSex().equals("女")){
hscj.setSex("1"); hscj.setSex("1");
......
...@@ -42,3 +42,23 @@ export function delGldry(id) { ...@@ -42,3 +42,23 @@ export function delGldry(id) {
method: 'delete' method: 'delete'
}) })
} }
// 下载导入模板
export function importTemplate(params) {
return request({
url: '/system/gldry/importTemplate',
method: 'get',
responseType: 'blob',
params
})
}
// 导入用户信息
export function importExcel(data) {
return request({
url: '/system/gldry/importData',
method: 'post',
responseType: 'blob',
data
})
}
...@@ -42,3 +42,23 @@ export function delHscj(id) { ...@@ -42,3 +42,23 @@ export function delHscj(id) {
method: 'delete' method: 'delete'
}) })
} }
// 下载导入模板
export function importTemplate(params) {
return request({
url: '/system/hscj/importTemplate',
method: 'get',
responseType: 'blob',
params
})
}
// 导入用户信息
export function importExcel(data) {
return request({
url: '/system/hscj/importData',
method: 'post',
responseType: 'blob',
data
})
}
...@@ -348,7 +348,7 @@ ...@@ -348,7 +348,7 @@
<script> <script>
import { listGldry, getGldry, delGldry, addGldry, updateGldry } from "@/api/system/gldry"; import { listGldry, getGldry, delGldry, addGldry, updateGldry } from "@/api/system/gldry";
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { importTemplate, importExcel } from "@/api/system/zlqk"; import { importTemplate, importExcel } from "@/api/system/gldry";
export default { export default {
name: "Gldry", name: "Gldry",
...@@ -370,7 +370,7 @@ export default { ...@@ -370,7 +370,7 @@ export default {
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: "Bearer " + getToken() },
// 上传的地址 // 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/zlqk/importTemplate" url: process.env.VUE_APP_BASE_API + "/system/gldry/exportTemplate"
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
...@@ -499,7 +499,7 @@ export default { ...@@ -499,7 +499,7 @@ export default {
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
this.importLoading = false this.importLoading = false
this.upload.title = "治疗情况导入"; this.upload.title = "隔离点人员信息导入";
this.upload.open = true; this.upload.open = true;
}, },
/** 下载模板操作 */ /** 下载模板操作 */
...@@ -509,7 +509,7 @@ export default { ...@@ -509,7 +509,7 @@ export default {
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接 const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href downloadElement.href = href
downloadElement.download = '治疗情况导入模板' + '.xls' // 下载后文件名 downloadElement.download = '隔离点人员信息导入模板' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载 downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素 document.body.removeChild(downloadElement)// 下载完成移除元素
......
...@@ -454,7 +454,7 @@ ...@@ -454,7 +454,7 @@
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 治疗情况导入对话框 --> <!-- 导入对话框 -->
<el-dialog :before-close="closeFileDialog" :title="upload.title" :close-on-click-modal="false" :visible.sync="upload.open" width="400px" append-to-body> <el-dialog :before-close="closeFileDialog" :title="upload.title" :close-on-click-modal="false" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload <el-upload
accept=".xlsx, .xls" accept=".xlsx, .xls"
...@@ -493,7 +493,7 @@ ...@@ -493,7 +493,7 @@
<script> <script>
import { listHscj, getHscj, delHscj, addHscj, updateHscj } from "@/api/system/hscj"; import { listHscj, getHscj, delHscj, addHscj, updateHscj } from "@/api/system/hscj";
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { importTemplate, importExcel } from "@/api/system/zlqk"; import { importTemplate, importExcel } from "@/api/system/hscj";
export default { export default {
...@@ -516,7 +516,7 @@ export default { ...@@ -516,7 +516,7 @@ export default {
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: "Bearer " + getToken() },
// 上传的地址 // 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/zlqk/importTemplate" url: process.env.VUE_APP_BASE_API + "/system/hscj/exportTemplate"
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
...@@ -656,7 +656,7 @@ export default { ...@@ -656,7 +656,7 @@ export default {
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
this.importLoading = false this.importLoading = false
this.upload.title = "治疗情况导入"; this.upload.title = "核酸采集信息导入";
this.upload.open = true; this.upload.open = true;
}, },
/** 下载模板操作 */ /** 下载模板操作 */
...@@ -666,7 +666,7 @@ export default { ...@@ -666,7 +666,7 @@ export default {
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接 const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href downloadElement.href = href
downloadElement.download = '治疗情况导入模板' + '.xls' // 下载后文件名 downloadElement.download = '核酸采集信息导入模板' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载 downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素 document.body.removeChild(downloadElement)// 下载完成移除元素
......
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