Commit c3896f75 authored by liufan's avatar liufan

修改:移装变更下载使用登记证时,添加校验

parent 6fbcfbe4
......@@ -155,25 +155,8 @@ public class JgChangeRegistrationTransferController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/export")
@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);
// 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();
}
}
......@@ -842,12 +842,24 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
exportParamsMap.put("isInvalid", transferEq.getIsInvalid());
JgRegistrationHistory transferHistory = jgRegistrationHistoryService.getDteailByRecord(transferEq.getEquId(), transfer.getApplyNo());
//登记机关
if(ValidationUtil.isEmpty(transfer.getReceiveOrgName())){
throw new BadRequest("使用登记证导出失败,登记机关为空!");
}
exportParamsMap.put("receiveOrgName", transfer.getReceiveOrgName());
//使用登记证编号
if(ValidationUtil.isEmpty(transfer.getUseRegistrationCode())){
throw new BadRequest("使用登记证导出失败,使用登记证编号为空!");
}
exportParamsMap.put("useRegistrationCode", transfer.getUseRegistrationCode());
//使用单位名称
if(ValidationUtil.isEmpty(transfer.getUseUnitName())){
throw new BadRequest("使用登记证导出失败,使用单位名称为空!");
}
exportParamsMap.put("useUnitName", transfer.getUseUnitName());
//监管码
if(ValidationUtil.isEmpty(transfer.getSupervisoryCode())){
throw new BadRequest("使用登记证导出失败,监管码为空!");
}
exportParamsMap.put("supervisoryCode", transfer.getSupervisoryCode());
//发证日期(当前时间)
LocalDate today = LocalDate.now();
......@@ -892,6 +904,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if (!ObjectUtils.isEmpty(address)) {
fullAddress += address;
}
if(ValidationUtil.isEmpty(fullAddress)){
throw new BadRequest("使用登记证导出失败,设备使用地址为空!");
}
exportParamsMap.put("fullAddress", fullAddress);
}
......@@ -905,27 +920,45 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null);
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, 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());
}
if (CollectionUtils.isNotEmpty(categoryList1)) {
if(ValidationUtil.isEmpty(categoryList1.get(0).getName())){
throw new BadRequest("使用登记证导出失败,设备类别为空!");
}
exportParamsMap.put("equCategory", categoryList1.get(0).getName());
}
if (CollectionUtils.isNotEmpty(categoryList2)) {
if(ValidationUtil.isEmpty(categoryList2.get(0).getName())){
throw new BadRequest("使用登记证导出失败,设备品种为空!");
}
exportParamsMap.put("equDefine", categoryList2.get(0).getName());
}
//设备代码
if(ValidationUtil.isEmpty(registerInfo.getEquCode())){
throw new BadRequest("使用登记证导出失败,设备代码为空!");
}
exportParamsMap.put("equCode", registerInfo.getEquCode());
}
//单位内部编码
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(transferEq.getEquId());
if(!ValidationUtil.isEmpty(useInfo)){
if(ValidationUtil.isEmpty(useInfo.getUseInnerCode())){
throw new BadRequest("使用登记证导出失败,设备单位内部编码为空!");
}
exportParamsMap.put("useInnerCode", useInfo.getUseInnerCode());
}
IdxBizJgFactoryInfo factoryInfo = idxBizJgFactoryInfoService.getOneData(transferEq.getEquId());
//产品编号(出厂编号)
if(!ValidationUtil.isEmpty(factoryInfo)){
if(ValidationUtil.isEmpty(factoryInfo.getFactoryNum())){
throw new BadRequest("使用登记证导出失败,产品编号为空!");
}
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