From bbb1b74f122affa814224dd2c9e5fb4ddcfcbe5a Mon Sep 17 00:00:00 2001 From: 郑永安 <zyazyz250@sina.com> Date: 星期一, 04 九月 2023 17:48:14 +0800 Subject: [PATCH] 添加字段 --- src/main/java/com/gk/hotwork/Domain/SafetyFacilityInspection.java | 13 ++++ src/main/java/com/gk/hotwork/Controller/SafetyFacilityInspectionController.java | 70 ++++++++++++++++++++++ src/main/resources/application-dev.yml | 45 +++++++------- src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityInspectionMapper.xml | 17 ++++- 4 files changed, 118 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/gk/hotwork/Controller/SafetyFacilityInspectionController.java b/src/main/java/com/gk/hotwork/Controller/SafetyFacilityInspectionController.java index 741f2c3..3b9ee50 100644 --- a/src/main/java/com/gk/hotwork/Controller/SafetyFacilityInspectionController.java +++ b/src/main/java/com/gk/hotwork/Controller/SafetyFacilityInspectionController.java @@ -253,7 +253,8 @@ @ApiImplicitParam(name = "expert", value = "审查专家", required = false), @ApiImplicitParam(name = "contact", value = "联系人", required = false), @ApiImplicitParam(name = "telephone", value = "联系电话", required = false), - @ApiImplicitParam(name = "company", value = "企业名称", required = false) }) + @ApiImplicitParam(name = "company", value = "企业名称", required = false), + @ApiImplicitParam(name = "acceptpdf", value = "受理通知书PDF", required = false) }) public Msg add(@RequestBody SafetyFacilityInspection param) { String genId = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli() + "" + (int) (Math.random() * 900 + 100); param.setId(Long.valueOf(genId)); @@ -264,7 +265,7 @@ flow.setCheckTime(date); flow.setProgressName("资料提交"); flow.setResult("资料提交"); - flow.setResolution("开始"); + flow.setResolution(param.getAcceptpdf()); flow.setLinkInspectionId(Long.valueOf(genId)); flow.setProcessBy(this.getUser().getRealname()); safetyFacilityProcessflowService.addOne(flow, this.getUser()); @@ -511,6 +512,71 @@ } + @ApiOperation("企业上传受理通知书") + @PostMapping("/uploadAcceptpdf") + @ApiImplicitParams({ @ApiImplicitParam(name = "file", value = "企业上传受理通知书(PDF/图片)") }) + public Msg uploadAcceptpdf(HttpServletRequest request, @RequestParam("file") MultipartFile file) { + if (file.getSize() > 1024 * 1024 * 10) { + return failed("文件超过10M无法上传"); + } + + String path = filePathConfig.getModule().get("correctPDF"); + String dcPath = filePathConfig.getDcPath(); + String originalFilename = file.getOriginalFilename(); + LocalDateTime now = LocalDateTime.now(); + File newFile = null; + + try { + String key = UUID.randomUUID().toString().replace("-", ""); + String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase(); + path = path.replace("/", File.separator); + String modulePath = now.getYear() + path + now.format(DateTimeFormatter.ofPattern("MMdd")); + String newFilePath = modulePath + File.separator + key + suffix; + String localPath = dcPath + newFilePath; + newFile = new File(localPath); + if (!newFile.exists() && !newFile.mkdirs()) { + return failed("文件上传路径不存在!"); + } + file.transferTo(newFile); + return success(newFilePath); + } catch (IOException e) { + if (newFile != null && newFile.exists()) { + newFile.delete(); + } + return failed("文件上传异常!"); + } + } + + @ApiOperation("查看企业受理通知书") + @PostMapping("/downAcceptpdf") + @ApiImplicitParams({ @ApiImplicitParam(name = "filename", value = "企业受理通知书文件名", required = true)}) + public void downAcceptpdf(@RequestBody FilterObject filterObject, HttpServletResponse response) throws Exception { + if (filterObject.getFilter().get("filename") == null) + return; + String filepath = filterObject.getFilter().get("filename").toString(); + String suffix = filepath.substring(filepath.lastIndexOf(".")).toLowerCase(); + response.reset(); + response.addHeader("Access-Control-Allow-Origin", "*"); + response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE"); + response.setContentType("application/octet-stream; charset=UTF-8"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("企业受理通知书" + suffix, StandardCharsets.UTF_8.name())); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + String dcPath = filePathConfig.getDcPath(); + File file = new File(dcPath + filepath); + if (!file.exists()) { + throw new BusinessException(ResultCodes.FILE_NOT_EXISIST); + } + response.addHeader("Content-Length", "" + file.length()); + FileInputStream inputStream = new FileInputStream(file); + byte[] b = new byte[inputStream.available()]; + inputStream.read(b); + ServletOutputStream outputStream = response.getOutputStream(); + outputStream.write(b); + outputStream.flush(); + inputStream.close(); + } + + @ApiOperation("专家审查上传补正告知书") @PostMapping("/uploadCorrectPDF") @ApiImplicitParams({ @ApiImplicitParam(name = "file", value = "上传补正告知书(PDF)文件") }) diff --git a/src/main/java/com/gk/hotwork/Domain/SafetyFacilityInspection.java b/src/main/java/com/gk/hotwork/Domain/SafetyFacilityInspection.java index 06abdc2..86877ce 100644 --- a/src/main/java/com/gk/hotwork/Domain/SafetyFacilityInspection.java +++ b/src/main/java/com/gk/hotwork/Domain/SafetyFacilityInspection.java @@ -56,6 +56,9 @@ /** 企业名称 company **/ private String company; + /** 企业受理通知书 acceptpdf **/ + private String acceptpdf; + /** 受理时间 accept_ time **/ private Date acceptTime; @@ -277,4 +280,14 @@ public void setExamineTaketime(String examineTaketime) { this.examineTaketime = examineTaketime == null ? null : examineTaketime.trim(); } + + /** 受理通知书 acceptpdf **/ + public String getAcceptpdf() { + return acceptpdf; + } + + /** 受理通知书 acceptpdf **/ + public void setAcceptpdf(String acceptpdf) { + this.acceptpdf = acceptpdf == null ? null : acceptpdf.trim(); + } } \ No newline at end of file diff --git a/src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityInspectionMapper.xml b/src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityInspectionMapper.xml index 3e57cb5..9332259 100644 --- a/src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityInspectionMapper.xml +++ b/src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyFacilityInspectionMapper.xml @@ -22,12 +22,13 @@ <result column="correctpdf" property="correctpdf" jdbcType="VARCHAR" /> <result column="examine_pageno" property="examinePageno" jdbcType="VARCHAR" /> <result column="examine_taketime" property="examineTaketime" jdbcType="VARCHAR" /> + <result column="acceptpdf" jdbcType="VARCHAR" property="acceptpdf" /> </resultMap> <sql id="Base_Column_List" > <!-- --> id, valid_flag, create_time, create_by, update_time, submit_date, type, project_name, progress, expert, contact, telephone, company, accept_time, review_time, examine_time, - correctpdf, examine_pageno, examine_taketime + correctpdf, examine_pageno, examine_taketime, acceptpdf </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <!-- --> @@ -49,14 +50,14 @@ expert, contact, telephone, company, accept_time, review_time, examine_time, correctpdf, examine_pageno, - examine_taketime) + examine_taketime, acceptpdf) values (#{id,jdbcType=BIGINT}, #{validFlag,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{submitDate,jdbcType=DATE}, #{type,jdbcType=INTEGER}, #{projectName,jdbcType=VARCHAR}, #{progress,jdbcType=INTEGER}, #{expert,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, #{company,jdbcType=VARCHAR}, #{acceptTime,jdbcType=TIMESTAMP}, #{reviewTime,jdbcType=TIMESTAMP}, #{examineTime,jdbcType=TIMESTAMP}, #{correctpdf,jdbcType=VARCHAR}, #{examinePageno,jdbcType=VARCHAR}, - #{examineTaketime,jdbcType=VARCHAR}) + #{examineTaketime,jdbcType=VARCHAR}, #{acceptpdf,jdbcType=VARCHAR}) </insert> <insert id="insertSelective" parameterType="com.gk.hotwork.Domain.SafetyFacilityInspection" > <!-- --> @@ -119,6 +120,9 @@ <if test="examineTaketime != null" > examine_taketime, </if> + <if test="acceptpdf != null"> + acceptpdf, + </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="id != null" > @@ -177,6 +181,9 @@ </if> <if test="examineTaketime != null" > #{examineTaketime,jdbcType=VARCHAR}, + </if> + <if test="acceptpdf != null"> + #{acceptpdf,jdbcType=VARCHAR}, </if> </trim> </insert> @@ -238,6 +245,9 @@ <if test="examineTaketime != null" > examine_taketime = #{examineTaketime,jdbcType=VARCHAR}, </if> + <if test="acceptpdf != null"> + acceptpdf = #{acceptpdf,jdbcType=VARCHAR}, + </if> </set> where id = #{id,jdbcType=BIGINT} </update> @@ -262,6 +272,7 @@ correctpdf = #{correctpdf,jdbcType=VARCHAR}, examine_pageno = #{examinePageno,jdbcType=VARCHAR}, examine_taketime = #{examineTaketime,jdbcType=VARCHAR} + acceptpdf = #{acceptpdf,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} </update> diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 51c888d..7587d74 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,7 +3,7 @@ tomcat: uri-encoding: UTF-8 basedir: / - port: 8016 + port: 8006 servlet: context-path: / # mysql @@ -14,13 +14,14 @@ username: root password: gkhymysql type: com.alibaba.druid.pool.DruidDataSource - + freemarker: + templateLoaderPath: classpath:/docxTemplate/ #redis redis: database: 14 - host: 127.0.0.1 + host: 114.116.227.52 port: 6379 - password: akj78avauba789a + password: 123456 jedis: pool: max-idle: 8 @@ -35,63 +36,63 @@ -host: http://localhost:8016 +host: http://localhost:8006 filePath: d:/uploads/ -fileurl: http://localhost:8016/upload/ +fileurl: http://localhost:8006/upload/ socketport: 504 sqlPath: /home/dbback/ -sqlurl: http://nmy.sinanoaq.cn:8016/dbback/ +sqlurl: http://nmy.sinanoaq.cn:8006/dbback/ enterprisePath: /home/uploads/enterprise/ -enterpriseUrl: http://nmy.sinanoaq.cn:8016/upload/enterprise/ +enterpriseUrl: http://nmy.sinanoaq.cn:8006/upload/enterprise/ enterprise: enterprise/ transportCertificatePath: /home/uploads/transportCertificate/ -transportCertificateUrl: http://nmy.sinanoaq.cn:8016/upload/transportCertificate/ +transportCertificateUrl: http://nmy.sinanoaq.cn:8006/upload/transportCertificate/ transportCertificate: transportCertificate/ hiddenDangerPath: /home/uploads/hiddenDanger/ -hiddenDangerUrl: http://nmy.sinanoaq.cn:8016/upload/hiddenDanger/ +hiddenDangerUrl: http://nmy.sinanoaq.cn:8006/upload/hiddenDanger/ hiddenDanger: hiddenDanger/ standardPath: /home/uploads/standard/ -standardUrl: http://nmy.sinanoaq.cn:8016/upload/standard/ +standardUrl: http://nmy.sinanoaq.cn:8006/upload/standard/ standard: standard/ contractPath: /home/uploads/contract/ -contractUrl: http://nmy.sinanoaq.cn:8016/upload/contract/ +contractUrl: http://nmy.sinanoaq.cn:8006/upload/contract/ contract: contract/ patrolPath: /home/uploads/patrol/ -patrolUrl: http://nmy.sinanoaq.cn:8016/upload/patrol/ +patrolUrl: http://nmy.sinanoaq.cn:8006/upload/patrol/ appPath: /home/uploads/app/ app: app/ -appUrl: http://nmy.sinanoaq.cn:8016/upload/app/ +appUrl: http://nmy.sinanoaq.cn:8006/upload/app/ productPath: /home/uploads/product/ -productUrl: http://nmy.sinanoaq.cn:8016/upload/product/ +productUrl: http://nmy.sinanoaq.cn:8006/upload/product/ assessApplyPath: /home/uploads/assessApply/ -assessApplytUrl: http://nmy.sinanoaq.cn:8016/upload/assessApply/ +assessApplytUrl: http://nmy.sinanoaq.cn:8006/upload/assessApply/ assessApply: assessApply/ workCertPath: /home/uploads/workCert/ -workCertUrl: http://nmy.sinanoaq.cn:8016/upload/workCert/ +workCertUrl: http://nmy.sinanoaq.cn:8006/upload/workCert/ workCert: workCert/ -nanowebUrl: http://nmy.sinanoaq.cn:8016/nanoweb/api/register +nanowebUrl: http://nmy.sinanoaq.cn:8006/nanoweb/api/register nanowebEnable: true taskPath: d:/uploads/task/ taskPathPrefix: d:/uploads/ -taskUrl: http://localhost:8016/upload/task/ +taskUrl: http://localhost:8006/upload/task/ task: task/ emergencyPlanPath: /home/uploads/emergencyPlan/ -emergencyPlanUrl: http://localhost:8016/upload/emergencyPlan/ +emergencyPlanUrl: http://localhost:8006/upload/emergencyPlan/ emergencyPlan : emergencyPlan/ safecheckExecImagePath : /home/uploads/safecheck/ @@ -119,7 +120,7 @@ file: path: #基础路径 - dcPath: E:\file\gkhy\test\ + dcPath: F:\file\gkhy\test\ urlRootPath: /uploadfile/ module: #用户模块 @@ -130,5 +131,5 @@ correctPDF: /correctPDF/ # swagger生产环境中禁止显示 -swagger: +swagger: show: true \ No newline at end of file -- Gitblit v1.9.2