Commit 981ffda6 authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 9ab0d89e e18ff21b
...@@ -145,23 +145,17 @@ public class ControllerAop { ...@@ -145,23 +145,17 @@ public class ControllerAop {
// 验证token有效性,防止token失效 // 验证token有效性,防止token失效
AgencyUserModel userModel; AgencyUserModel userModel;
try { try {
// StopWatch stopWatch = new StopWatch();
// stopWatch.start("1");
String authToken = RedisKey.buildReginKey(RequestContext.getExeUserId(), token); String authToken = RedisKey.buildReginKey(RequestContext.getExeUserId(), token);
if (redisUtils.hasKey(authToken)) { if (redisUtils.hasKey(authToken)) {
logger.info("登录命中缓存 ,直接返回!!===========>"); logger.info("登录命中缓存 ,直接返回!!===========>");
return; return;
} }
// stopWatch.stop(); FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
// logger.info("get auth token count time===========> {}", stopWatch.getTotalTimeSeconds()); userModel = agencyUserModel.getResult();
// stopWatch.start("2"); if (userModel == null) {
// FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme(); throw new Exception("无法获取用户信息");
// userModel = agencyUserModel.getResult(); }
// if (userModel == null) { RequestContext.setExeUserId(userModel.getUserId());
// throw new Exception("无法获取用户信息");
// }
// RequestContext.setExeUserId(userModel.getUserId());
// logger.info("get me count time===========> {}", stopWatch.getTotalTimeSeconds());
} catch (Exception e) { } catch (Exception e) {
// 删除失效token缓存 // 删除失效token缓存
logger.info("catch pattern before==========>" + pattern); logger.info("catch pattern before==========>" + pattern);
...@@ -169,8 +163,8 @@ public class ControllerAop { ...@@ -169,8 +163,8 @@ public class ControllerAop {
logger.info("catch pattern after==========>" + pattern); logger.info("catch pattern after==========>" + pattern);
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
// saveUserRedis(userModel, token); saveUserRedis(userModel, token);
saveUserRedis(); // saveUserRedis();
} else { } else {
throw new AuthException("请求未包含认证信息."); throw new AuthException("请求未包含认证信息.");
} }
......
...@@ -155,25 +155,8 @@ public class JgChangeRegistrationTransferController extends BaseController { ...@@ -155,25 +155,8 @@ public class JgChangeRegistrationTransferController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/export") @GetMapping(value = "/export")
@ApiOperation(httpMethod = "GET", value = "导出使用登记证", notes = "导出使用登记证") @ApiOperation(httpMethod = "GET", value = "导出使用登记证", notes = "导出使用登记证")
public void exportImageZip(HttpServletResponse response, @RequestParam("sequenceNbr") String sequenceNbr) throws IOException { public void exportImageZip(HttpServletResponse response, @RequestParam("sequenceNbr") String sequenceNbr){
jgChangeRegistrationTransferService.exportUseRegistrationCertificate(sequenceNbr, response); jgChangeRegistrationTransferService.exportUseRegistrationCertificate(sequenceNbr, response);
// if(ValidationUtil.isEmpty(file)){
// throw new BadRequest("使用登记证导出失败,请稍后重试!");
// }
// FileInputStream in = new FileInputStream(file);
// response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("使用登记证", "UTF-8") + ".pdf");
// response.setHeader("content-Type", "application/msword");
// response.setCharacterEncoding("utf-8");
//
// OutputStream out = new BufferedOutputStream(response.getOutputStream());
// int b = 0;
// byte[] buffer = new byte[2048];
// while ((b = in.read(buffer)) != -1) {
// out.write(buffer, 0, b);
// }
// in.close();
// out.flush();
// out.close();
} }
} }
...@@ -165,7 +165,7 @@ public class JgTransferNoticeController extends BaseController { ...@@ -165,7 +165,7 @@ public class JgTransferNoticeController extends BaseController {
public void generateCertificateReport(HttpServletResponse response) { public void generateCertificateReport(HttpServletResponse response) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
// 组装模板变量 // 组装模板变量
map.put("useRegistrationCode", "202311056"); // 编号 map.put("useRegistrationCode", "202301256456"); // 编号
map.put("useUnitName", "西安市高科物业服务有限公司"); // 使用单位名称 map.put("useUnitName", "西安市高科物业服务有限公司"); // 使用单位名称
map.put("fullAddress", "西安市曲江新区春临东街南湖意境1单元2号楼"); // 设备使用地点 map.put("fullAddress", "西安市曲江新区春临东街南湖意境1单元2号楼"); // 设备使用地点
map.put("equList", "电梯"); // 设备种类 map.put("equList", "电梯"); // 设备种类
......
...@@ -289,21 +289,21 @@ public class CommonServiceImpl implements ICommonService { ...@@ -289,21 +289,21 @@ public class CommonServiceImpl implements ICommonService {
throw new IllegalArgumentException("参数不能为空"); throw new IllegalArgumentException("参数不能为空");
} }
// 组装模板变量 // 组装模板变量
map.put("useRegistrationCode", map.getOrDefault("useRegistrationCode", "").toString()); // 编号 map.put("useRegistrationCode", Optional.ofNullable(map.get("useRegistrationCode")).orElse("").toString()); // 编号
map.put("useUnitName", map.getOrDefault("useUnitName", "").toString()); // 使用单位名称 map.put("useUnitName", Optional.ofNullable(map.get("useUnitName")).orElse("").toString()); // 使用单位名称
map.put("fullAddress", map.getOrDefault("fullAddress", "").toString()); // 设备使用地点 map.put("fullAddress", Optional.ofNullable(map.get("fullAddress")).orElse("").toString()); // 设备使用地点
map.put("equList", map.getOrDefault("equList", "").toString()); // 设备种类 map.put("equList", Optional.ofNullable(map.get("equList")).orElse("").toString()); // 设备种类
map.put("equipDefine", map.getOrDefault("equipDefine", "").toString()); // 设备品种 map.put("equipDefine", Optional.ofNullable(map.get("equipDefine")).orElse("").toString()); // 设备品种
map.put("equipCode", map.getOrDefault("equipCode", "").toString()); // 设备代码 map.put("equipCode", Optional.ofNullable(map.get("equipCode")).orElse("").toString()); // 设备代码
map.put("equipCategory", map.getOrDefault("equipCategory", "").toString()); // 设备类别 map.put("equipCategory", Optional.ofNullable(map.get("equipCategory")).orElse("").toString()); // 设备类别
map.put("useInnerCode", map.getOrDefault("useInnerCode", "").toString()); // 单位内编号 map.put("useInnerCode", Optional.ofNullable(map.get("useInnerCode")).orElse("").toString()); // 单位内编号
map.put("factoryNum", map.getOrDefault("factoryNum", "").toString()); // 产品编号 map.put("factoryNum", Optional.ofNullable(map.get("factoryNum")).orElse("").toString()); // 产品编号
map.put("receiveOrgName", map.getOrDefault("receiveOrgName", "").toString()); // 登记机关 map.put("receiveOrgName", Optional.ofNullable(map.get("receiveOrgName")).orElse("").toString()); // 登记机关
map.put("giveOutYear", map.getOrDefault("giveOutYear", "").toString()); // 发证日期-年 map.put("giveOutYear", Optional.ofNullable(map.get("giveOutYear")).orElse("").toString()); // 发证日期-年
map.put("giveOutMonth", map.getOrDefault("giveOutMonth", "").toString()); // 发证日期-月 map.put("giveOutMonth", Optional.ofNullable(map.get("giveOutMonth")).orElse("").toString()); // 发证日期-月
map.put("giveOutDay", map.getOrDefault("giveOutDay", "").toString()); // 发证日期-日 map.put("giveOutDay", Optional.ofNullable(map.get("giveOutDay")).orElse("").toString()); // 发证日期-日
// 生成二维码 // 生成二维码
String qrCode = ImageUtils.generateQRCode(map.getOrDefault("supervisoryCode", "").toString(), 70, 65); String qrCode = ImageUtils.generateQRCode(Optional.ofNullable(map.get("supervisoryCode")).orElse("").toString(), 70, 65);
map.put("supervisoryCode", qrCode); // 监管二维码 map.put("supervisoryCode", qrCode); // 监管二维码
// word转pdf // word转pdf
...@@ -330,6 +330,12 @@ public class CommonServiceImpl implements ICommonService { ...@@ -330,6 +330,12 @@ 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("pdf文件转换失败:{}", e); log.error("pdf文件转换失败:{}", e);
} finally {
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (Exception e) {
log.error("文件找不到,删除失败:{}", e);
}
} }
} }
......
...@@ -842,12 +842,24 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -842,12 +842,24 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
exportParamsMap.put("isInvalid", transferEq.getIsInvalid()); exportParamsMap.put("isInvalid", transferEq.getIsInvalid());
JgRegistrationHistory transferHistory = jgRegistrationHistoryService.getDteailByRecord(transferEq.getEquId(), transfer.getApplyNo()); JgRegistrationHistory transferHistory = jgRegistrationHistoryService.getDteailByRecord(transferEq.getEquId(), transfer.getApplyNo());
//登记机关 //登记机关
if(ValidationUtil.isEmpty(transfer.getReceiveOrgName())){
throw new BadRequest("使用登记证导出失败,登记机关为空!");
}
exportParamsMap.put("receiveOrgName", transfer.getReceiveOrgName()); exportParamsMap.put("receiveOrgName", transfer.getReceiveOrgName());
//使用登记证编号 //使用登记证编号
if(ValidationUtil.isEmpty(transfer.getUseRegistrationCode())){
throw new BadRequest("使用登记证导出失败,使用登记证编号为空!");
}
exportParamsMap.put("useRegistrationCode", transfer.getUseRegistrationCode()); exportParamsMap.put("useRegistrationCode", transfer.getUseRegistrationCode());
//使用单位名称 //使用单位名称
if(ValidationUtil.isEmpty(transfer.getUseUnitName())){
throw new BadRequest("使用登记证导出失败,使用单位名称为空!");
}
exportParamsMap.put("useUnitName", transfer.getUseUnitName()); exportParamsMap.put("useUnitName", transfer.getUseUnitName());
//监管码 //监管码
if(ValidationUtil.isEmpty(transfer.getSupervisoryCode())){
throw new BadRequest("使用登记证导出失败,监管码为空!");
}
exportParamsMap.put("supervisoryCode", transfer.getSupervisoryCode()); exportParamsMap.put("supervisoryCode", transfer.getSupervisoryCode());
//发证日期(当前时间) //发证日期(当前时间)
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
...@@ -892,6 +904,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -892,6 +904,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if (!ObjectUtils.isEmpty(address)) { if (!ObjectUtils.isEmpty(address)) {
fullAddress += address; fullAddress += address;
} }
if(ValidationUtil.isEmpty(fullAddress)){
throw new BadRequest("使用登记证导出失败,设备使用地址为空!");
}
exportParamsMap.put("fullAddress", fullAddress); exportParamsMap.put("fullAddress", fullAddress);
} }
...@@ -905,27 +920,45 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -905,27 +920,45 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null); List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null);
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null); List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null);
List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null); List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null);
if (CollectionUtils.isNotEmpty(categoryList1)) { if (CollectionUtils.isNotEmpty(categoryList0)) {
if(ValidationUtil.isEmpty(categoryList0.get(0).getName())){
throw new BadRequest("使用登记证导出失败,设备种类为空!");
}
exportParamsMap.put("equList", categoryList0.get(0).getName()); exportParamsMap.put("equList", categoryList0.get(0).getName());
} }
if (CollectionUtils.isNotEmpty(categoryList1)) { if (CollectionUtils.isNotEmpty(categoryList1)) {
if(ValidationUtil.isEmpty(categoryList1.get(0).getName())){
throw new BadRequest("使用登记证导出失败,设备类别为空!");
}
exportParamsMap.put("equCategory", categoryList1.get(0).getName()); exportParamsMap.put("equCategory", categoryList1.get(0).getName());
} }
if (CollectionUtils.isNotEmpty(categoryList2)) { if (CollectionUtils.isNotEmpty(categoryList2)) {
if(ValidationUtil.isEmpty(categoryList2.get(0).getName())){
throw new BadRequest("使用登记证导出失败,设备品种为空!");
}
exportParamsMap.put("equDefine", categoryList2.get(0).getName()); exportParamsMap.put("equDefine", categoryList2.get(0).getName());
} }
//设备代码 //设备代码
if(ValidationUtil.isEmpty(registerInfo.getEquCode())){
throw new BadRequest("使用登记证导出失败,设备代码为空!");
}
exportParamsMap.put("equCode", registerInfo.getEquCode()); exportParamsMap.put("equCode", registerInfo.getEquCode());
} }
//单位内部编码 //单位内部编码
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(transferEq.getEquId()); IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(transferEq.getEquId());
if(!ValidationUtil.isEmpty(useInfo)){ if(!ValidationUtil.isEmpty(useInfo)){
if(ValidationUtil.isEmpty(useInfo.getUseInnerCode())){
throw new BadRequest("使用登记证导出失败,设备单位内部编码为空!");
}
exportParamsMap.put("useInnerCode", useInfo.getUseInnerCode()); exportParamsMap.put("useInnerCode", useInfo.getUseInnerCode());
} }
IdxBizJgFactoryInfo factoryInfo = idxBizJgFactoryInfoService.getOneData(transferEq.getEquId()); IdxBizJgFactoryInfo factoryInfo = idxBizJgFactoryInfoService.getOneData(transferEq.getEquId());
//产品编号(出厂编号) //产品编号(出厂编号)
if(!ValidationUtil.isEmpty(factoryInfo)){ if(!ValidationUtil.isEmpty(factoryInfo)){
if(ValidationUtil.isEmpty(factoryInfo.getFactoryNum())){
throw new BadRequest("使用登记证导出失败,产品编号为空!");
}
exportParamsMap.put("factoryNum", factoryInfo.getFactoryNum()); exportParamsMap.put("factoryNum", factoryInfo.getFactoryNum());
} }
//调用生成使用登记证 //调用生成使用登记证
......
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