仪器管理-配置说明书

master
382696293@qq.com 2 years ago
parent cdfecf607f
commit b6c9782e4e

@ -5,6 +5,7 @@ import com.flossom.system.utils.QrCodeUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -14,6 +15,7 @@ import java.io.IOException;
@RestController
@RequestMapping("/qrcode")
@RefreshScope
public class QrCodeController {
@Value("${qrcode.url}")

@ -1,26 +1,23 @@
package com.flossom.system.controller;
import java.io.*;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.WxInstrumentInstructions;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.flossom.system.service.IWxInstrumentInstructionsService;
/**
@ -75,4 +72,35 @@ public class WxInstrumentInstructionsController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wxInstrumentInstructionsService.deleteWxInstrumentInstructionsByIds(ids));
}
/**
* TODO
*
*
* @param id id
* @param type
* <p>
*
* {@link utilsTest.pdfPreview.PdfPreviewTest#method1(HttpServletResponse, String)}
*/
@GetMapping("/book")
public void book(HttpServletResponse response, @RequestParam("type") String type, @RequestParam("id") Integer id) throws IOException, ServletException {
WxInstrumentInstructions query = new WxInstrumentInstructions();
query.setInstrumentId(id.longValue());
query.setName(type);
List<WxInstrumentInstructions> instructionList = wxInstrumentInstructionsService.selectWxInstrumentInstructionsList(query);
if (instructionList != null && instructionList.size() > 0 && StringUtils.isNotBlank(instructionList.get(0).getLink())) {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(instructionList.get(0).getLink());
try (CloseableHttpResponse resp = httpClient.execute(httpGet)) {
InputStream inputStream = resp.getEntity().getContent();
ServletOutputStream outputStream = response.getOutputStream();
IOUtils.copy(inputStream, outputStream);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

@ -832,7 +832,7 @@
<el-input placeholder="请输入说明书类型" v-model="scope.row.name" clearable/>
</template>
</el-table-column>
<el-table-column align="center" prop="link" width="300" label="说明书">
<el-table-column align="center" prop="link" width="250" label="说明书(每个类型只能上传一个说明书)">
<!-- scope.row.link -->
<template slot-scope="scope">
<el-upload
@ -849,12 +849,13 @@
accept=".pdf,.PDF"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传一个文件</div>
</el-upload>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-save" @click="viewInstrumentInstruction(scope.row)">
</el-button>
<el-button size="mini" type="text" icon="el-icon-save" @click="saveInstrumentInstruction(scope.row)">
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="delInstrumentInstruction(scope)">
@ -1723,10 +1724,9 @@ export default {
if (response.data != null && response.data.length > 0) {
this.instrumentInstructions.instructionList = response.data;
for (let i = 0; i < response.data.length; i++) {
let name = response.data.url;
this.instrumentInstructions.instructionList[i].fileList = [{
name: name,
url: response.data.url,
name: response.data[i].name + ".pdf",
url: response.data[i].url,
}];
}
} else {
@ -1787,6 +1787,9 @@ export default {
this.$message.error('图片插入失败')
}
},
viewInstrumentInstruction(item) {
window.open(item.link, '_blank');
},
},
}
</script>

Loading…
Cancel
Save