Browse Source

000000005

zhoulisky 7 months ago
parent
commit
ee9df98eac

BIN
doc/xls导入模板/科技人员管理/每月参研人员填报.xlsx


+ 27 - 27
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/vo/TorchDevYBVO.java

@@ -97,36 +97,36 @@ public class TorchDevYBVO implements Serializable {
 	//自主知识产权情况
 	//当年专利申请数
 	@Schema(description = "当年专利申请数")
-	private Integer qj55 = 0;
+	private Long qj55 = 0L;
 	@Schema(description = "其中:申请发明专利")
-	private Integer qj56 = 0;
+	private Long qj56 = 0L;
 	@Schema(description = "其中:申请国内发明专利")
-	private Integer qj56_1 = 0;
+	private Long qj56_1 = 0L;
 	@Schema(description = "其中:申请欧美日专利")
-	private Integer qj55_1 = 0;
+	private Long qj55_1 = 0L;
 	@Schema(description = "其中:申请PCT国际专利")
-	private Integer qj55_2 = 0;
+	private Long qj55_2 = 0L;
 
 	//当年专利授权数
 	@Schema(description = "当年专利授权数")
-	private Integer qj74 = 0;
+	private Long qj74 = 0L;
 	@Schema(description = "其中:授权发明专利")
-	private Integer qj57 = 0;
+	private Long qj57 = 0L;
 	@Schema(description = "其中:授权国内发明专利")
-	private Integer qj57_1 = 0;
+	private Long qj57_1 = 0L;
 	@Schema(description = "其中:授权欧美日专利")
-	private Integer qj75 = 0;
+	private Long qj75 = 0L;
 
  	@Schema(description = "期末拥有有效专利数")
-	private Integer qj83 = 0;
+	private Long qj83 = 0L;
 	@Schema(description = "其中:拥有境外授权专利")
-	private Integer qj83_1 = 0;
+	private Long qj83_1 = 0L;
 	@Schema(description = "其中:拥有欧美日专利")
-	private Integer qj82 = 0;
+	private Long qj82 = 0L;
 	@Schema(description = "其中:拥有发明专利")
-	private Integer qj73 = 0;
+	private Long qj73 = 0L;
 	@Schema(description = "其中:境外授权发明专利")
-	private Integer qj73_1 = 0;
+	private Long qj73_1 = 0L;
 
 	//其他情况
 	@Schema(description = "发表科技论文")
@@ -134,32 +134,32 @@ public class TorchDevYBVO implements Serializable {
 	@Schema(description = "拥有软件著作权")
 	private Integer qj85 = 0;
 	@Schema(description = "其中:当年获得软件著作权")
-	private Integer qj85_1 = 0;
+	private Long qj85_1 = 0L;
 	@Schema(description = "拥有集成电路布图")
-	private Integer qj86 = 0;
+	private Long qj86 = 0L;
 	@Schema(description = "其中:当年获得集成电路布图")
-	private Integer qj86_1 = 0;
+	private Long qj86_1 = 0L;
 
 	@Schema(description = "拥有植物新品种")
-	private Integer qj87 = 0;
+	private Long qj87 = 0L;
 	@Schema(description = "其中:当年获得植物新品种")
-	private Integer qj87_1 = 0;
+	private Long qj87_1 = 0L;
 	@Schema(description = "拥有国家一类新药品种")
-	private Integer qj101 = 0;
+	private Long qj101 = 0L;
 	@Schema(description = "其中:当年获得国家一类新药证书")
-	private Integer qj101_1 = 0;
+	private Long qj101_1 = 0L;
 	@Schema(description = "拥有国家一级中药保护品种")
-	private Integer qj100 = 0;
+	private Long qj100 = 0L;
 	@Schema(description = "其中:当年获得国家一级中药保护品种证书")
-	private Integer qj100_1 = 0;
+	private Long qj100_1 = 0L;
 	@Schema(description = "累计形成国际标准")
-	private Integer qj98 = 0;
+	private Long qj98 = 0L;
 	@Schema(description = "其中:当年形成国际标准")
-	private Integer qj98_1 = 0;
+	private Long qj98_1 = 0L;
 	@Schema(description = "累计形成国家或行业标准")
-	private Integer qi27 = 0;
+	private Long qi27 = 0L;
 	@Schema(description = "其中:当年形成国家或行业标准")
-	private Integer qi27_1 = 0;
+	private Long qi27_1 = 0L;
 
 
 }

+ 6 - 1
kd-service/kd-scientific/src/main/java/org/sky/scientific/controller/EnterpriseController.java

@@ -218,7 +218,6 @@ public class EnterpriseController extends KdController {
 				throw new RuntimeException(e);
 			}
 		}).start();
-
 	}
 
 	@GetMapping("hjfznb")
@@ -228,4 +227,10 @@ public class EnterpriseController extends KdController {
 		return R.data(enterpriseInfoService.torchDevYB(year));
 	}
 
+	@GetMapping("/hjfznb/export")
+	@ApiOperationSupport(order = 51)
+	@Operation(summary = "火炬发展年报-导出")
+	public void exportTorchDevYB(HttpServletResponse response, String year) {
+		enterpriseInfoService.exportTorchDevYB(response, year);
+	}
 }

+ 2 - 0
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/IEnterpriseInfoService.java

@@ -144,4 +144,6 @@ public interface IEnterpriseInfoService extends BaseService<EnterpriseInfoEntity
 	 * @return
 	 */
     TorchDevYBVO torchDevYB(String year);
+
+	void exportTorchDevYB(HttpServletResponse response, String year);
 }

+ 2 - 2
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/CgRjzzqServiceImpl.java

@@ -86,7 +86,7 @@ public class CgRjzzqServiceImpl extends BaseServiceImpl<CgRjzzqMapper, CgRjzzqEn
 
 	@Override
 	public boolean updateRjzzq(CgRjzzqEntity rjzzq) {
-		if (isDuplicate(rjzzq)) {
+		if (!isDuplicate(rjzzq)) {
 			throw new ServiceException("软件名称已存在");
 		}
 		return updateById(rjzzq);
@@ -102,7 +102,7 @@ public class CgRjzzqServiceImpl extends BaseServiceImpl<CgRjzzqMapper, CgRjzzqEn
 		if (list.size() > 1) {
 			return true;
 		}
-		return Func.notNull(rjzzq.getId()) ? Objects.equals(rjzzq.getId(), list.get(0).getId()) : true;
+		return !Func.notNull(rjzzq.getId()) || Objects.equals(rjzzq.getId(), list.get(0).getId());
 	}
 
 	@Override

+ 2 - 2
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/CgZlServiceImpl.java

@@ -93,7 +93,7 @@ public class CgZlServiceImpl extends BaseServiceImpl<CgZlMapper, CgZlEntity> imp
 		if(list.size() > 1){
 			return true;
 		}
-		return Func.notNull(cgZl.getId()) ? Objects.equals(cgZl.getId(), list.get(0).getId()) : true;
+		return !Func.notNull(cgZl.getId()) || Objects.equals(cgZl.getId(), list.get(0).getId());
 	}
 
 	@Override
@@ -106,7 +106,7 @@ public class CgZlServiceImpl extends BaseServiceImpl<CgZlMapper, CgZlEntity> imp
 
 	@Override
 	public boolean update(CgZlEntity cgZl) {
-		if(isDuplicate(cgZl)){
+		if(!isDuplicate(cgZl)){
 			throw new ServiceException("专利号/专利名称已存在");
 		}
 		return updateById(cgZl);

+ 65 - 54
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/EnterpriseInfoServiceImpl.java

@@ -347,7 +347,6 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 					d30++;
 				}
 			}
-
 			if (Func.notNull(shouquanRq) && shouquanRq.before(dateMax) && shouquanRq.after(dateMin)) {
 				d32++;
 			}
@@ -1143,62 +1142,74 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 		//(一)自主知识产权情况
 		List<CgZlEntity> zlList = zlMapper.selectList(Wrappers.<CgZlEntity>lambdaQuery().eq(CgZlEntity::getTenantId, SecureUtil.getTenantId()));
 
-		int qj55 = 0, qj56 = 0, qj56_1 = 0, qj55_1 = 0, qj55_2 = 0, qj74 = 0, qj57 = 0, qj57_1 = 0, qj75 = 0, qj83=0;
-		Date dateMin = DateUtil.parse(year + "-01-01", DateUtil.PATTERN_DATE);
+ 		Date dateMin = DateUtil.parse(year + "-01-01", DateUtil.PATTERN_DATE);
 		Date dateMax = DateUtil.parse(year + "-12-31", DateUtil.PATTERN_DATE);
-		for (CgZlEntity zl : zlList) {
-			Date shenqingRq = zl.getShenqingRq();
-			Date shouquanRq = zl.getShouquanRq();
-			if (Func.notNull(shenqingRq)) {
-				if (Func.equals(year, DateUtil.format(shenqingRq, DateUtil.PATTERN_YYYY))) {
-					if (Func.equals("发明专利", zl.getZllx())) {
-						qj56++;
-						if (Func.equals("国内", zl.getGb())) {
-							qj56_1++;
-						}
-					}
-					if (Func.equals("境外(欧美日)", zl.getGb())) {
-						qj55_1++;
-					}
-					if (Func.equals("PCT国际专利", zl.getGb())) {
-						qj55_2++;
-					}
-					qj55++;
-				}
-			}
-			if (Func.notNull(shouquanRq)) {
-				if (Func.equals(year, DateUtil.format(shouquanRq, DateUtil.PATTERN_YYYY))) {
-					if (Func.equals("发明专利", zl.getZllx())) {
-						qj57++;
-						if (Func.equals("国内", zl.getGb())) {
-							qj57_1++;
-						}
-					}
-					if (Func.equals("境外(欧美日)", zl.getGb())) {
-						qj75++;
-					}
-					qj74++;
-				}
-			}
-
-			if (Func.notNull(shouquanRq) && shouquanRq.before(dateMax) && shouquanRq.after(dateMin)) {
-				qj83++;
-
-			}
-		}
-		vo.setQj55(qj55);
-		vo.setQj56(qj56);
-		vo.setQj56_1(qj56_1);
-		vo.setQj55_1(qj55_1);
-		vo.setQj55_2(qj55_2);
-
-		vo.setQj74(qj74);
-		vo.setQj57(qj57);
-		vo.setQj57_1(qj57_1);
-		vo.setQj75(qj75);
-
 
+		vo.setQj55(zlList.stream().filter(zl -> Func.notNull(zl.getShenqingRq()) && zl.getShenqingRq().before(dateMax) && zl.getShenqingRq().after(dateMin)).count());
+		vo.setQj56(zlList.stream().filter(zl -> Func.notNull(zl.getShenqingRq()) && zl.getShenqingRq().before(dateMax) && zl.getShenqingRq().after(dateMin) && Func.equals("发明专利", zl.getZllx())).count());
+		vo.setQj56_1(zlList.stream().filter(zl -> Func.notNull(zl.getShenqingRq()) && zl.getShenqingRq().before(dateMax) && zl.getShenqingRq().after(dateMin) && Func.equals("发明专利", zl.getZllx()) && Func.equals("国内", zl.getGb())).count());
+		vo.setQj55_1(zlList.stream().filter(zl -> Func.notNull(zl.getShenqingRq()) && zl.getShenqingRq().before(dateMax) && zl.getShenqingRq().after(dateMin) && Func.equals("境外(欧美日)", zl.getGb())).count());
+		vo.setQj55_2(zlList.stream().filter(zl -> Func.notNull(zl.getShenqingRq()) && zl.getShenqingRq().before(dateMax) && zl.getShenqingRq().after(dateMin) && Func.equals("PCT国际专利", zl.getGb())).count());
+
+		vo.setQj74(zlList.stream().filter(zl -> Func.notNull(zl.getShouquanRq()) && zl.getShouquanRq().before(dateMax) && zl.getShouquanRq().after(dateMin)).count());
+		vo.setQj57(zlList.stream().filter(zl -> Func.notNull(zl.getShouquanRq()) && zl.getShouquanRq().before(dateMax) && zl.getShouquanRq().after(dateMin) && Func.equals("发明专利", zl.getZllx())).count());
+		vo.setQj57_1(zlList.stream().filter(zl -> Func.notNull(zl.getShouquanRq()) && zl.getShouquanRq().before(dateMax) && zl.getShouquanRq().after(dateMin) && Func.equals("发明专利", zl.getZllx()) && Func.equals("国内", zl.getGb())).count());
+		vo.setQj75(zlList.stream().filter(zl -> Func.notNull(zl.getShouquanRq()) && zl.getShouquanRq().before(dateMax) && zl.getShouquanRq().after(dateMin) && Func.equals("境外(欧美日)", zl.getGb())).count());
+
+		vo.setQj83(zlList.stream().filter(zl -> Func.notNull(zl.getShouquanRq()) && zl.getShouquanRq().before(dateMax) && zl.getShouquanRq().after(dateMin)).count());
+
+		//(三)其他情况
+		//发表科技论文
+		List<CgKylwEntity> kylwList = kylwMapper.selectList(Wrappers.<CgKylwEntity>lambdaQuery().eq(CgKylwEntity::getTenantId, SecureUtil.getTenantId()));
+		vo.setQi25(Func.isEmpty(kylwList)?0:kylwList.size());
+		//拥有软件著作权
+		List<CgRjzzqEntity> rjzzqList = rjzzqMapper.selectList(Wrappers.<CgRjzzqEntity>lambdaQuery().eq(CgRjzzqEntity::getTenantId, SecureUtil.getTenantId()));
+		vo.setQj85(Func.isEmpty(rjzzqList)?0:rjzzqList.size());
+		//其中:当年获得软件著作权
+		vo.setQj85_1(rjzzqList.stream().filter(item -> Func.notNull(item.getDjpzrq()) && item.getDjpzrq().before(dateMax) && item.getDjpzrq().after(dateMin)).count());
+		//拥有集成电路布图
+		List<CgQtEntity> qtList = qtMapper.selectList(Wrappers.<CgQtEntity>lambdaQuery().eq(CgQtEntity::getTenantId, SecureUtil.getTenantId()));
+		vo.setQj86(qtList.stream().filter(item -> Func.notNull(item.getShouquanRq()) && Func.equals(item.getCmlx(), "集成电路布图设计专有权")).count());
+		//其中:当年获得集成电路布图
+		vo.setQj86_1(qtList.stream().filter(item -> Func.notNull(item.getShouquanRq()) && Func.equals(item.getCmlx(), "集成电路布图设计专有权") && item.getShouquanRq().before(dateMax) && item.getShouquanRq().after(dateMin)).count());
+		//拥有植物新品种
+		vo.setQj87(qtList.stream().filter(item ->  Func.equals(item.getCmlx(), "植物新品种")).count());
+		vo.setQj87_1(qtList.stream().filter(item -> Func.notNull(item.getShouquanRq()) && Func.equals(item.getCmlx(), "植物新品种") && item.getShouquanRq().before(dateMax) && item.getShouquanRq().after(dateMin)).count());
+		//拥有国家一类新药品种
+		vo.setQj101(qtList.stream().filter(item ->  Func.equals(item.getCmlx(), "国家新药")).count());
+		vo.setQj101_1(qtList.stream().filter(item -> Func.notNull(item.getShouquanRq()) && Func.equals(item.getCmlx(), "国家新药") && item.getShouquanRq().before(dateMax) && item.getShouquanRq().after(dateMin)).count());
+		//拥有国家一级中药保护品种
+		vo.setQj100(qtList.stream().filter(item ->   Func.equals(item.getCmlx(), "国家一级中药保护品种")).count());
+		vo.setQj100_1(qtList.stream().filter(item -> Func.notNull(item.getShouquanRq()) && Func.equals(item.getCmlx(), "国家一级中药保护品种") && item.getShouquanRq().before(dateMax) && item.getShouquanRq().after(dateMin)).count());
+		//累计形成国际标准
+		List<CgJsbzEntity> jsbzList = jsbzMapper.selectList(Wrappers.<CgJsbzEntity>lambdaQuery().eq(CgJsbzEntity::getTenantId, SecureUtil.getTenantId()));
+		vo.setQj98(jsbzList.stream().filter(item -> Func.equals(item.getBzlb(), "国际标准")).count());
+		vo.setQj98_1(jsbzList.stream().filter(item -> Func.notNull(item.getSsrq()) && Func.equals(item.getBzlb(), "国际标准") && Func.equals(item.getState(), "现行有效") && item.getSsrq().before(dateMax) && item.getSsrq().after(dateMin)).count());
+		//累计形成国家或行业标准
+		vo.setQi27(jsbzList.stream().filter(item -> Func.equals(item.getBzlb(), "国家标准") || Func.equals(item.getBzlb(), "行业标准")).count());
+		vo.setQi27_1(jsbzList.stream().filter(item -> Func.notNull(item.getSsrq()) && Func.equals(item.getBzlb(), "国家标准") || Func.equals(item.getBzlb(), "行业标准") && Func.equals(item.getState(), "现行有效") && item.getSsrq().before(dateMax) && item.getSsrq().after(dateMin)).count());
 		return vo;
 	}
 
+	@SneakyThrows
+	@Override
+	public void exportTorchDevYB(HttpServletResponse response, String year) {
+		InputStream templateFileName = this.getClass().getClassLoader().getResourceAsStream("export-template/对外报表管理/火炬发展年报.xlsx");
+		response.setContentType("application/vnd.ms-excel");
+		response.setCharacterEncoding("utf-8");
+		response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("火炬发展年报.xlsx", Charsets.UTF_8));
+		ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream())
+			.withTemplate((templateFileName))
+			.excelType(ExcelTypeEnum.XLSX)
+			.build();
+		TorchDevYBVO torchDevYBVO = this.torchDevYB(year);
+		WriteSheet writeSheet = EasyExcel.writerSheet().build();
+		FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
+		//设置list集合数据
+		excelWriter.fill(torchDevYBVO, fillConfig, writeSheet);
+		excelWriter.finish();
+		if (templateFileName != null) {
+			templateFileName.close();
+		}
+	}
 }

BIN
kd-service/kd-scientific/src/main/resources/export-template/对外报表管理/火炬发展年报.xlsx