Commit 79684bb7 authored by 韩桐桐's avatar 韩桐桐

补证登记相关

parent 1af789fd
package com.yeejoin.amos.boot.module.jg.api.dto; package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
...@@ -28,6 +29,12 @@ public class JgCertificateReplenishDto extends BaseDto { ...@@ -28,6 +29,12 @@ public class JgCertificateReplenishDto extends BaseDto {
@ApiModelProperty(value = "设备种类") @ApiModelProperty(value = "设备种类")
private String equList; private String equList;
@ApiModelProperty(value = "设备类别编码")
private String equCategoryCode;
@ApiModelProperty(value = "设备类别")
private String equCategory;
@ApiModelProperty(value = "申请编号") @ApiModelProperty(value = "申请编号")
private String applyNo; private String applyNo;
...@@ -112,4 +119,7 @@ public class JgCertificateReplenishDto extends BaseDto { ...@@ -112,4 +119,7 @@ public class JgCertificateReplenishDto extends BaseDto {
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createUserName; private String createUserName;
@ApiModelProperty("是否车用气瓶1是,0不是(特种气瓶使用)")
private String whetherVehicleCylinder;
} }
...@@ -40,6 +40,18 @@ public class JgCertificateReplenish extends BaseEntity { ...@@ -40,6 +40,18 @@ public class JgCertificateReplenish extends BaseEntity {
private String equList; private String equList;
/** /**
* 设备类别编码
*/
@TableField("equ_category_code")
private String equCategoryCode;
/**
* 设备类别
*/
@TableField("equ_category")
private String equCategory;
/**
* 申请编号 * 申请编号
*/ */
@TableField("apply_no") @TableField("apply_no")
...@@ -207,4 +219,10 @@ public class JgCertificateReplenish extends BaseEntity { ...@@ -207,4 +219,10 @@ public class JgCertificateReplenish extends BaseEntity {
@TableField("create_user_name") @TableField("create_user_name")
private String createUserName; private String createUserName;
/**
* 是否车用气瓶1是,0不是(特种气瓶使用)
*/
@TableField("whether_vehicle_cylinder")
private String whetherVehicleCylinder;
} }
package com.yeejoin.amos.boot.module.jg.api.service; package com.yeejoin.amos.boot.module.jg.api.service;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/** /**
* 使用登记表补证接口类 * 使用登记表补证接口类
* *
* @author system_generator * @author system_generator
* @date 2025-03-19 * @date 2025-03-19
*/ */
public interface IJgCertificateReplenishService {} public interface IJgCertificateReplenishService {
Map<String, Object> getCertReplenishFormUrl(JSONObject map);
void getCertReplenishFormStream(JSONObject jsonObject, HttpServletResponse response);
}
...@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory; ...@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgCertificateReplenishService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService; import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService; import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.service.IPdfService; import com.yeejoin.amos.boot.module.jg.biz.service.IPdfService;
...@@ -29,6 +30,7 @@ import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; ...@@ -29,6 +30,7 @@ import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -53,21 +55,14 @@ import java.util.stream.Collectors; ...@@ -53,21 +55,14 @@ import java.util.stream.Collectors;
@RestController @RestController
@Api(tags = "监管公共Api") @Api(tags = "监管公共Api")
@RequestMapping(value = "/common") @RequestMapping(value = "/common")
@RequiredArgsConstructor
public class CommonController extends BaseController { public class CommonController extends BaseController {
@Autowired private final ICommonService commonService;
ICommonService commonService; private final IPdfService pdfService;
private final JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired private final JgUseRegistrationMapper jgUseRegistrationMapper;
IPdfService pdfService; private final IJgCertificateReplenishService iJgCertificateReplenishService;
private final CodeUtil codeUtil;
@Autowired
JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired
JgUseRegistrationMapper jgUseRegistrationMapper;
@Autowired
CodeUtil codeUtil;
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/currentLoginInfo") @GetMapping(value = "/currentLoginInfo")
...@@ -810,4 +805,18 @@ public class CommonController extends BaseController { ...@@ -810,4 +805,18 @@ public class CommonController extends BaseController {
formData.put("userName",selectedOrgInfo.getUserModel().getRealName()); formData.put("userName",selectedOrgInfo.getUserModel().getRealName());
commonService.getRegistrationFormStream(formData,manageType,response); commonService.getRegistrationFormStream(formData,manageType,response);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "补证申请表生成", notes = "补证申请表生成")
@PostMapping(value = "/getCertReplenishFormUrl")
public ResponseModel<Map<String, Object>> getCertReplenishFormUrl(@RequestBody JSONObject jsonObject) {
return ResponseHelper.buildResponse(iJgCertificateReplenishService.getCertReplenishFormUrl(jsonObject));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "补证pdf流生成", notes = "补证pdf流生成")
@PostMapping(value = "/getCertReplenishFormStream")
public void getCertReplenishFormStream(HttpServletResponse response, @RequestBody JSONObject jsonObject) {
iJgCertificateReplenishService.getCertReplenishFormStream(jsonObject, response);
}
} }
...@@ -1212,13 +1212,14 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1212,13 +1212,14 @@ public class CommonServiceImpl implements ICommonService {
* 上传文件至文件服务器 * 上传文件至文件服务器
* *
* @param file 文件 * @param file 文件
* @param path 路径
*/ */
private String uploadFile(File file) { public String uploadFile(File file, String path) {
Assert.notNull(file, "文件不能为空"); Assert.notNull(file, "文件不能为空");
MultipartFile multipartFile = new ByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(file)); MultipartFile multipartFile = new ByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(file));
// 返回路径 : upload/common/useregistrationformfiles/xxx.xx // 返回路径 : upload/common/${path}/xxx.xx
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFileFree(multipartFile, "useRegistrationFormFiles"); FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFileFree(multipartFile, path);
String urlString = ""; String urlString = "";
if (result != null) { if (result != null) {
for (String s : result.getResult().keySet()) { for (String s : result.getResult().keySet()) {
...@@ -2446,7 +2447,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2446,7 +2447,7 @@ public class CommonServiceImpl implements ICommonService {
File pdfFile = null; File pdfFile = null;
try { try {
pdfFile = wordToPdf(fileName, wordPath, formData); pdfFile = wordToPdf(fileName, wordPath, formData);
return MapBuilder.<String, Object>create().put("useRegistrationFormUrl", uploadFile(pdfFile)).build(); return MapBuilder.<String, Object>create().put("useRegistrationFormUrl", uploadFile(pdfFile, "useRegistrationFormFiles")).build();
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
}finally { }finally {
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.entity.JgCertificateReplenish; import com.yeejoin.amos.boot.module.jg.api.entity.JgCertificateReplenish;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgCertificateReplenishMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgCertificateReplenishMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgCertificateReplenishService; import com.yeejoin.amos.boot.module.jg.api.service.IJgCertificateReplenishService;
import com.yeejoin.amos.boot.module.jg.biz.utils.FileExporter;
import lombok.RequiredArgsConstructor;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.nio.file.Files;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 使用登记表补证服务实现类 * 使用登记表补证服务实现类
...@@ -16,7 +26,10 @@ import java.util.List; ...@@ -16,7 +26,10 @@ import java.util.List;
* @date 2025-03-19 * @date 2025-03-19
*/ */
@Service @Service
@RequiredArgsConstructor
public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificateReplenish, JgCertificateReplenish, JgCertificateReplenishMapper> implements IJgCertificateReplenishService { public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificateReplenish, JgCertificateReplenish, JgCertificateReplenishMapper> implements IJgCertificateReplenishService {
private final CommonServiceImpl commonService;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -30,4 +43,97 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate ...@@ -30,4 +43,97 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
public List<JgCertificateReplenish> queryForJgCertificateReplenishList() { public List<JgCertificateReplenish> queryForJgCertificateReplenishList() {
return this.queryForList("", false); return this.queryForList("", false);
} }
/**
* 补证申请表生成
*
* @param jsonObject
* @return
*/
@Override
public Map<String, Object> getCertReplenishFormUrl(JSONObject jsonObject) {
JSONObject formData = this.writeCertReplenishFormData(jsonObject);
String wordPath = "CertificateReplenish.ftl";
String fileName = "使用登记证补证申请表_";
File pdfFile = null;
try {
pdfFile = commonService.wordToPdf(fileName, wordPath, formData);
return MapBuilder.<String, Object>create()
.put("certReplenishFormUrl", commonService.uploadFile(pdfFile, "certificateReplenishFiles"))
.build();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
try {
assert pdfFile != null;
Files.deleteIfExists(pdfFile.toPath());
} catch (Exception e) {
log.error("文件找不到,删除失败:{}", e);
}
}
}
/**
* 补证pdf流生成
*
* @param jsonObject
* @param response
*/
@Override
public void getCertReplenishFormStream(JSONObject jsonObject, HttpServletResponse response) {
JSONObject formData = this.writeCertReplenishFormData(jsonObject);
String wordPath = "CertificateReplenish.ftl";
String fileName = "使用登记证补证申请表_";
File pdfFile;
try {
pdfFile = commonService.wordToPdf(fileName, wordPath, formData);
} catch (Exception e) {
throw new RuntimeException(e);
}
try {
byte[] bytes = CommonServiceImpl.file2byte(pdfFile);
String docTitle = pdfFile.getName();
FileExporter.exportFile(FileExporter.FileType.valueOf("pdf"), docTitle, bytes, response);
} catch (Exception e) {
log.error("pdf文件转换失败:{}", e);
} finally {
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (Exception e) {
log.error("文件找不到,删除失败:{}", e);
}
}
}
private JSONObject writeCertReplenishFormData(JSONObject jsonObject) {
JSONObject result = new JSONObject();
result.put("applyNo", "applyNo");
result.put("useUnitName", "useUnitName");
result.put("useUnitAddress", "useUnitAddress");
result.put("applicationReason", "1");
result.put("lossDamageTime", "2022-09-09");
result.put("safetyManagerName", "张三");
result.put("safetyManagerPhone", "13209090909");
JSONArray equLists = new JSONArray();
equLists.fluentAdd(MapBuilder.<String, Object>create()
.put("index", "1")
.put("productName", "产品名称")
.put("equCode", "设备代码")
.put("useRegistrationCode", "使用登记证编号")
.put("factoryNum", "设备编号")
.build())
.fluentAdd(MapBuilder.<String, Object>create()
.put("index", "2")
.put("productName", "产品名称1")
.put("equCode", "设备代码2")
.put("useRegistrationCode", "使用登记证编号3")
.put("factoryNum", "设备编号4")
.build());
result.put("equLists", equLists);
result.put("handler", "handler");
result.put("applicationDateYear", "2001");
result.put("applicationDateMonth", "12");
result.put("applicationDateDay", "12");
return result;
}
} }
\ No newline at end of file
...@@ -41,6 +41,11 @@ ...@@ -41,6 +41,11 @@
"image": "upload/tzs/common/image/使用登记.png" "image": "upload/tzs/common/image/使用登记.png"
}, },
{ {
"name": "补证登记",
"code": "DJ_BZ",
"image": "upload/tzs/common/image/更名变更登记.png"
},
{
"name": "改造变更登记", "name": "改造变更登记",
"code": "DJ_GZ", "code": "DJ_GZ",
"image": "upload/tzs/common/image/改造变更登记.png" "image": "upload/tzs/common/image/改造变更登记.png"
......
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