Commit 9503842c authored by suhuiguang's avatar suhuiguang

1.使用标志自测修改

parent 87e02122
package com.yeejoin.amos.boot.module.jg.api.dto; package com.yeejoin.amos.boot.module.jg.api.dto;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
...@@ -95,6 +96,12 @@ public class UseFlagParamDto { ...@@ -95,6 +96,12 @@ public class UseFlagParamDto {
*/ */
private String cylinderNumOrVolume; private String cylinderNumOrVolume;
/**
* 充装介质--车用气瓶专用
*/
private String fillingMedium;
/** /**
* 申请编号 * 申请编号
*/ */
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.dto.UseFlagParamDto;
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;
...@@ -21,6 +22,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -21,6 +22,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -373,4 +375,39 @@ public class CommonController extends BaseController { ...@@ -373,4 +375,39 @@ public class CommonController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/use-flag-test")
@ApiOperation(httpMethod = "GET", value = "使用标志生成测试", notes = "使用标志生成测试")
public ResponseModel<String> getUserPhone(HttpServletResponse response) {
UseFlagParamDto useFlagParamDto = buildUseFlagParam();
commonService.useFlagGenerate(useFlagParamDto, response);
return ResponseHelper.buildResponse("succese");
}
private UseFlagParamDto buildUseFlagParam(){
UseFlagParamDto useFlagParamDto = new UseFlagParamDto();
useFlagParamDto.setEquList("设备种类名称");
useFlagParamDto.setEquListCode("0000");
useFlagParamDto.setEquipCode("10001101");
// useFlagParamDto.setEquipDefine("设备品种");
useFlagParamDto.setUseUnitName("使用单位名称");
useFlagParamDto.setEquipCategory("设备类别名称");
useFlagParamDto.setUseInnerCode("单位内编号");
useFlagParamDto.setReceiveOrgName("登记机关");
useFlagParamDto.setInspectionUnitName("检验机构名称");
useFlagParamDto.setUseRegistrationCode("11111");
useFlagParamDto.setNextInspectionDate(new Date());
useFlagParamDto.setMaintenanceUnitName("维保单位名称");
useFlagParamDto.setEmergencyTel("17792961611");
useFlagParamDto.setCarNumber("车牌号");
useFlagParamDto.setFactoryNumber("产品编号");
useFlagParamDto.setCylinderNumOrVolume("12");
useFlagParamDto.setFillingMedium("氮气");
useFlagParamDto.setApplyNo("101");
return useFlagParamDto;
}
} }
...@@ -353,18 +353,19 @@ public class CommonServiceImpl implements ICommonService { ...@@ -353,18 +353,19 @@ public class CommonServiceImpl implements ICommonService {
@Override @Override
public void useFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) { public void useFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) {
if (useFlagParamDto == null) { Objects.requireNonNull(useFlagParamDto, "参数不能为空");
throw new IllegalArgumentException("参数不能为空");
} Map<String, Object> paramMap = Bean.BeantoMap(useFlagParamDto);
Map<String, Object> paramMap; // 二维码设置
paramMap = Bean.BeantoMap(useFlagParamDto);
// 设置二维码
setQrCode(useFlagParamDto, paramMap); setQrCode(useFlagParamDto, paramMap);
// 日期设置
setNextDate(useFlagParamDto, paramMap); setNextDate(useFlagParamDto, paramMap);
String ftlPath = this.getFtlPathByBiz(useFlagParamDto); String ftlPath = this.getFtlPathByBiz(useFlagParamDto);
if (StringUtils.isEmpty(ftlPath)) { if (StringUtils.isEmpty(ftlPath)) {
throw new BadRequest("无法找到使用标志"); throw new BadRequest("无法找到使用标志模板!");
} }
File pdfFile = null; File pdfFile = null;
try { try {
pdfFile = this.wordToPdf("特种设备使用标志_", ftlPath, paramMap); pdfFile = this.wordToPdf("特种设备使用标志_", ftlPath, paramMap);
...@@ -373,17 +374,18 @@ public class CommonServiceImpl implements ICommonService { ...@@ -373,17 +374,18 @@ public class CommonServiceImpl implements ICommonService {
FileExporter.exportFile(FileExporter.FileType.valueOf("pdf"), docTitle, bytes, response); FileExporter.exportFile(FileExporter.FileType.valueOf("pdf"), docTitle, bytes, response);
} catch (Exception e) { } catch (Exception e) {
log.error("特种设备使用标志生成失败", e); log.error("特种设备使用标志生成失败", e);
throw new RuntimeException(e); throw new RuntimeException("特种设备使用标志生成失败", e);
} finally { } finally {
if (pdfFile != null) { if (pdfFile != null) {
pdfFile.deleteOnExit(); pdfFile.delete();
} }
} }
} }
private void setNextDate(UseFlagParamDto useFlagParamDto, Map<String, Object> paramMap) { private void setNextDate(UseFlagParamDto useFlagParamDto, Map<String, Object> paramMap) {
if (useFlagParamDto.getNextInspectionDate() != null) { if (useFlagParamDto.getNextInspectionDate() != null) {
paramMap.put("year", DateUtil.year(useFlagParamDto.getNextInspectionDate())); paramMap.put("year", DateUtil.year(useFlagParamDto.getNextInspectionDate()) + "");
paramMap.put("month", DateUtil.month(useFlagParamDto.getNextInspectionDate()) + 1); paramMap.put("month", DateUtil.month(useFlagParamDto.getNextInspectionDate()) + 1);
} }
} }
...@@ -563,12 +565,16 @@ public class CommonServiceImpl implements ICommonService { ...@@ -563,12 +565,16 @@ public class CommonServiceImpl implements ICommonService {
@Override @Override
public List<Map<String, Object>> getUnitListByType(String type) { public List<Map<String, Object>> getUnitListByType(String type) {
if (type.equals("use")) { switch (type) {
type = "使用单位"; case "use":
} else if (type.equals("maintenance")) { type = "使用单位";
type = "安装改造维修单位"; break;
} else if (type.equals("inspection")) { case "maintenance":
type = "检验检测机构"; type = "安装改造维修单位";
break;
case "inspection":
type = "检验检测机构";
break;
} }
return commonMapper.getUnitListByType(type); return commonMapper.getUnitListByType(type);
} }
...@@ -1394,7 +1400,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1394,7 +1400,7 @@ public class CommonServiceImpl implements ICommonService {
/** /**
* 生成使用登记编号 * 生成使用登记编号
* *
* @param equipId 设备id * @param equipId 设备id
* @param supervisoryCompanyCode 接收机构单位代码 * @param supervisoryCompanyCode 接收机构单位代码
* @return 使用登记编号 * @return 使用登记编号
*/ */
...@@ -1414,7 +1420,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1414,7 +1420,7 @@ public class CommonServiceImpl implements ICommonService {
String equipType2MidDigits; String equipType2MidDigits;
if (ValidationUtil.isEmpty(equDefine)) { if (ValidationUtil.isEmpty(equDefine)) {
// 没有设备品种的设备取设备类别代码中间两位 // 没有设备品种的设备取设备类别代码中间两位
equipType2MidDigits = equCategory.substring(1,3); equipType2MidDigits = equCategory.substring(1, 3);
} else { } else {
// 设备品种代码中间两位 // 设备品种代码中间两位
equipType2MidDigits = equDefine.substring(1, 3); equipType2MidDigits = equDefine.substring(1, 3);
......
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