Commit 3246ce83 authored by 韩桐桐's avatar 韩桐桐

feat(jg):气瓶基本信息汇总表导出zip接口

parent 7bd193bf
......@@ -175,6 +175,15 @@ public class JgUseRegistrationController extends BaseController {
jgUseRegistrationServiceImpl.exportUseRegistrationCertificate(sequenceNbr, response, printType);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/summaryBasicInfo/{category}/export")
@ApiOperation(httpMethod = "GET", value = "导出基本信息汇总表(工业管道/气瓶)", notes = "导出基本信息汇总表(工业管道/气瓶)")
public void exportSummaryBasicInfo(HttpServletResponse response,
@RequestParam("sequenceNbr") String sequenceNbr,
@PathVariable(value = "category") String category) {
jgUseRegistrationServiceImpl.exportSummaryBasicInfo(sequenceNbr, response, category);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getRegion")
@ApiOperation(httpMethod = "GET", value = "", notes = "")
......
......@@ -47,6 +47,8 @@ public interface ICommonService {
void generatePdfPrint(Map<String, Object> map, HttpServletResponse response);
byte[] generateSummaryOfCylinderInfo(Map<String, Object> map, String wordPath,String filePrefix);
List<LinkedHashMap> creatApproveTree();
List<Map<String, Object>> superviseBusinessCategory(String businessType);
......
......@@ -106,6 +106,8 @@ import java.util.stream.Collectors;
public class CommonServiceImpl implements ICommonService {
public static final String SPECIAL_REGION_CODE = "SpecialRegionCode";
public static final String YWCJ = "YWCJ";
public static final String DICT_DATA_KEY = "dictDataKey";
// 行政区划redis缓存key
private static final String PROVINCE = "PROVINCE";
private static final String CITY = "CITY";
......@@ -130,7 +132,6 @@ public class CommonServiceImpl implements ICommonService {
private static final String REGULATOR_UNIT_TREE_ALL = "REGULATOR_UNIT_TREE_ALL";
// 行政审批局redis缓存key
private static final String ADMINISTRATION_UNIT_TREE = "ADMINISTRATION_UNIT_TREE";
private static final String XZSB = "XZSB";
private static final String CODE = "code";
private static final String PL_DR = "PL_DR";
......@@ -160,18 +161,7 @@ public class CommonServiceImpl implements ICommonService {
private static final String SBZX_PAGE_ID = "jgScrapCancelAdd";
// 业务通用发起——更名变更表单key
private static final String GMBG_PAGE_ID = "jgRegistrationInfo";
private static final String SELECTED_ROLE_SEQS = "selectRoleSeqs";
public static final String YWCJ = "YWCJ";
public static final String DICT_DATA_KEY = "dictDataKey";
@Value("${redis.cache.failure.time}")
private Long redisRegionTimeSecond;
@Autowired
EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
......@@ -215,6 +205,8 @@ public class CommonServiceImpl implements ICommonService {
IdxBizJgSupervisionInfoMapper idxBizJgSupervisionInfoMapper;
@Autowired
RedissonClient redissonClient;
@Value("${redis.cache.failure.time}")
private Long redisRegionTimeSecond;
@Autowired
private RedisUtils redisUtils;
@Value("classpath:/json/superviseBusinessCategory.json")
......@@ -306,6 +298,17 @@ public class CommonServiceImpl implements ICommonService {
return sb.toString();
}
private static String getSelectedRoleRedisKey() {
return RequestContext.getToken() + "_" + SELECTED_ROLE_SEQS;
}
private static void convertAndAddToUnitList(DictionarieValueModel x, List<Map<String, Object>> unitList) {
HashMap<String, Object> map = new HashMap<>();
map.put("useCode", x.getDictDataKey());
map.put("useUnit", x.getDictDataValue());
unitList.add(map);
}
@PostConstruct
public void init() {
companyCodeRegNameMap = JsonUtils.getResourceJson(regNameJson);
......@@ -433,7 +436,7 @@ public class CommonServiceImpl implements ICommonService {
Object roleSeqs = redisUtils.get(getSelectedRoleRedisKey());
Collection<PermissionModel> permissionModels;
// 监管单位
if (!"company".equals(company.getLevel()) || null == roleSeqs){
if (!"company".equals(company.getLevel()) || null == roleSeqs) {
permissionModels = FeignUtil.remoteCall(() -> Privilege.permissionClient.currentPermissionTree(menuAgent, permissionType, null, path));
} else {
permissionModels = FeignUtil.remoteCall(() -> Privilege.permissionClient.treeByRoles(roleSeqs.toString(), menuAgent, permissionType, path, RequestContext.getAppKey()));
......@@ -443,10 +446,6 @@ public class CommonServiceImpl implements ICommonService {
return result;
}
private static String getSelectedRoleRedisKey() {
return RequestContext.getToken() + "_" + SELECTED_ROLE_SEQS;
}
@Override
public void useFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) {
Objects.requireNonNull(useFlagParamDto, "参数不能为空");
......@@ -614,7 +613,7 @@ public class CommonServiceImpl implements ICommonService {
public List<Map<String, Object>> superviseBusinessCategory(String businessType) {
ReginParams reginParams = getSelectedOrgInfo();
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(superviseBusinessCategory);
if (XZSB.equals(businessType) && CompanyTypeEnum.CONSTRUCTION.getName().equals(reginParams.getCompany().getCompanyType())){
if (XZSB.equals(businessType) && CompanyTypeEnum.CONSTRUCTION.getName().equals(reginParams.getCompany().getCompanyType())) {
Iterator<Map<String, Object>> iterator = resourceJson.get(businessType).iterator();
while (iterator.hasNext()) {
Map<String, Object> item = iterator.next();
......@@ -631,8 +630,8 @@ public class CommonServiceImpl implements ICommonService {
public List<Map<String, Object>> businessScenarios(String type) {
ReginParams reginParams = getSelectedOrgInfo();
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(superviseBusinessCategory);
//新增设备 或者 安改维单位 只有按照设备种类选择的业务
if (PL_DR.equals(type) || CompanyTypeEnum.CONSTRUCTION.getName().equals(reginParams.getCompany().getCompanyType())){
// 新增设备 或者 安改维单位 只有按照设备种类选择的业务
if (PL_DR.equals(type) || CompanyTypeEnum.CONSTRUCTION.getName().equals(reginParams.getCompany().getCompanyType())) {
Iterator<Map<String, Object>> iterator = resourceJson.get(YWCJ).iterator();
while (iterator.hasNext()) {
Map<String, Object> item = iterator.next();
......@@ -721,25 +720,17 @@ public class CommonServiceImpl implements ICommonService {
// 检验检测机构 追加车用气瓶
if ("检验检测机构".equals(type) && "gasCylindersForCars".equals(business)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_INSPECTION_TESTING_UNIT").getResult();
result.forEach(x-> convertAndAddToUnitList(x, unitList));
result.forEach(x -> convertAndAddToUnitList(x, unitList));
}
if ("安装改造维修单位".equals(type) && "gasCylindersForCars".equals(business)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_INSTALLATION_UNIT").getResult();
result.forEach(x-> convertAndAddToUnitList(x, unitList));
result.forEach(x -> convertAndAddToUnitList(x, unitList));
}
List<Map<String, Object>> unitListByType = commonMapper.getUnitListByType(type);
unitList.addAll(unitListByType);
return unitList;
}
private static void convertAndAddToUnitList(DictionarieValueModel x, List<Map<String, Object>> unitList) {
HashMap<String, Object> map = new HashMap<>();
map.put("useCode", x.getDictDataKey());
map.put("useUnit", x.getDictDataValue());
unitList.add(map);
}
@Override
public List<Map<String, Object>> getSecurityAdmin(String type, String companyCode) {
if (ObjectUtils.isEmpty(companyCode)) {
......@@ -919,6 +910,35 @@ public class CommonServiceImpl implements ICommonService {
this.fillParamValueToPdf(map, response, "templates/use-registration-model.pdf", "套打使用登记证.pdf", 12.0f);
}
@Override
public byte[] generateSummaryOfCylinderInfo(Map<String, Object> map, String wordPath, String filePrefix) {
if (CollectionUtils.isEmpty(map)) {
throw new IllegalArgumentException("参数不能为空");
}
// 默认普打
map.put("printingType", PrintingTypeEnum.REGULAR.getCode());
// word转pdf
File pdfFile;
try {
pdfFile = this.wordToPdf("", wordPath, map);
} catch (Exception e) {
throw new RuntimeException(e);
}
// file转字节流
try {
return file2byte(pdfFile);
} catch (Exception e) {
log.error("pdf文件转换失败:{}", e);
} finally {
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (Exception e) {
log.error("文件找不到,删除失败:{}", e);
}
}
return new byte[0];
}
/**
* 根据参数填充PDF文本域
*
......@@ -992,7 +1012,7 @@ public class CommonServiceImpl implements ICommonService {
private File wordToPdf(String filePrefix, String wordPath, Map<String, Object> placeholders) throws Exception {
Assert.hasText(wordPath, "word文件路径不能为空");
String tempFileName = filePrefix + System.currentTimeMillis() + "_temp.pdf";
String tempFileName = filePrefix + System.currentTimeMillis() + Thread.currentThread().getName() + "_temp.pdf";
WordTemplateUtils instance = WordTemplateUtils.getInstance();
......@@ -1711,7 +1731,7 @@ public class CommonServiceImpl implements ICommonService {
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
lambda.eq(JgRegistrationHistory::getCurrentDocumentId, currentDocumentId);
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambda);
if(jgRegistrationHistory != null){
if (jgRegistrationHistory != null) {
String changeData = jgRegistrationHistory.getChangeData();
try {
// 尝试解析为JSONArray
......
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