Browse Source

对外报表1

zhouli 9 months ago
parent
commit
07df6f4238

BIN
doc/xls导入模板/科研成果-专利成果.xls


+ 2 - 0
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/entity/A107_1.java

@@ -1,5 +1,6 @@
 package org.sky.scientific.pojo.entity;
 
+import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
@@ -12,6 +13,7 @@ import java.math.BigDecimal;
 
 @EqualsAndHashCode(callSuper = true)
 @Data
+@TableName("kd_107_1")
 @Schema(description = "107-1 企业研究开发项目情况")
 public class A107_1 extends TenantEntity {
 

+ 1 - 0
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/entity/YsZjfyycqdtfyEntity.java

@@ -44,6 +44,7 @@ public class YsZjfyycqdtfyEntity extends TenantEntity {
 	private String zcmc;
 
 	@Schema(description = "月折旧额/月摊销额(元)")
+	@TableField(exist = false)
  	private BigDecimal yzje;
 
 	@Schema(description = "在项目中的工作时长(月)")

+ 5 - 5
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/vo/YsZjfyycqdtfyVO.java

@@ -1,11 +1,9 @@
 
 package org.sky.scientific.pojo.vo;
 
-import io.swagger.v3.oas.annotations.media.Schema;
-import org.sky.scientific.pojo.entity.YsZjfyycqdtfyEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import org.sky.scientific.pojo.entity.AssetEntity;
+import org.sky.scientific.pojo.entity.YsZjfyycqdtfyEntity;
 
 import java.io.Serial;
 
@@ -20,8 +18,10 @@ import java.io.Serial;
 public class YsZjfyycqdtfyVO extends YsZjfyycqdtfyEntity {
 	@Serial
 	private static final long serialVersionUID = 1L;
+//
+//	@Schema(description = "资产信息")
+//	private AssetEntity zcEntity;
+
 
-	@Schema(description = "资产信息")
-	private AssetEntity zcEntity;
 
 }

+ 7 - 2
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/A107_1Mapper.java

@@ -1,8 +1,12 @@
-
 package org.sky.scientific.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.sky.core.tenant.annotation.TenantIgnore;
 import org.sky.scientific.pojo.entity.A107_1;
+import org.sky.scientific.pojo.vo.A107_1VO;
+
+import java.util.List;
 
 /**
  * 107-1企业研究开发项目情况 Mapper 接口
@@ -12,5 +16,6 @@ import org.sky.scientific.pojo.entity.A107_1;
  */
 public interface A107_1Mapper extends BaseMapper<A107_1> {
 
-
+	@TenantIgnore
+	List<A107_1VO> qyyjkfxmqk(@Param("year") String year, @Param("tenantId") String tenantId);
 }

+ 23 - 0
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/A107_1Mapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.sky.scientific.mapper.A107_1Mapper">
+
+    <select id="qyyjkfxmqk" resultType="org.sky.scientific.pojo.vo.A107_1VO">
+        SELECT
+        xm.*, tmp.xm_stage,tmp.gov_bonus,
+        IFNULL((SELECT COUNT(DISTINCT unicode) FROM kd_xm_technician xt where xt.xm_id = xm.xm_id GROUP BY xt.year_and_month ORDER BY xt.year_and_month desc  limit 1),0) as technicianCount
+        FROM
+        (
+            SELECT
+                xm.id as xm_id,xm.tenant_id,
+                COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMMC' AND DATE_FORMAT(bgrz.BGSXSJ,'%Y') <![CDATA[<=]]> #{year} ORDER BY bgrz.BGSXSJ DESC LIMIT 1),XMMC) AS XMMC,
+                xm.XMLY,xm.XMKZXS as kzxs,xm.YQCGXS as cgxs,xm.XMJSJJMB as jsjjmb,
+                xm.XMKSSJ as kssj,
+                COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMJSSJ' AND DATE_FORMAT(bgrz.BGSXSJ,'%Y') <![CDATA[<=]]>  #{year} ORDER BY bgrz.BGSXSJ DESC LIMIT 1),XMJSSJ) AS jssj
+            FROM kd_xm xm
+        ) xm
+        LEFT JOIN kd_107_1 tmp on tmp.xm_id = xm.xm_id and tmp.year_and_month = #{year}
+        WHERE xm.tenant_id = #{tenantId} and left(xm.jssj,4) >= #{year}
+    </select>
+
+</mapper>

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

@@ -4,6 +4,7 @@ package org.sky.scientific.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
+import org.sky.core.tenant.annotation.TenantIgnore;
 import org.sky.scientific.pojo.dto.TechnicianDTO;
 import org.sky.scientific.pojo.entity.TechnicianEntity;
 import org.sky.scientific.pojo.vo.TechnicianVO;
@@ -48,5 +49,6 @@ public interface TechnicianMapper extends BaseMapper<TechnicianEntity> {
 	/**
 	 * 年度科技人员汇总表
 	 */
+	@TenantIgnore
 	List<TechnicianVO> niandugaokejirenyuanhuizongbiao(@Param("page") IPage<TechnicianVO> page, @Param("ew") TechnicianDTO dto);
 }

+ 1 - 1
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/TechnicianMapper.xml

@@ -143,7 +143,7 @@
             GROUP BY unicode
             ORDER BY t.year_and_month desc
         )t on t.unicode = h.unicode
-        WHERE LEFT(work_date, 4) = #{ew.yearAndMonth}
+        WHERE h.tenant_id = #{ew.tenantId} and LEFT(work_date, 4) = #{ew.yearAndMonth} and work_hours > 0
         <if test="ew.name!=null and ew.name!=''">and t.name like concat('%', #{ew.name},'%')</if>
         <if test="ew.number!=null and ew.number!=''">and t.number like concat('%',#{ew.number}, '%')</if>
         <if test="ew.idCard!=null and ew.idCard!=''">and t.id_card like concat('%', #{ew.idCard}, '%')</if>

+ 1 - 1
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/XmMapper.xml

@@ -113,7 +113,7 @@
             COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMYSZEMX' and bgrz.BGSXSJ <![CDATA[<=]]> now() ORDER BY bgrz.BGSXSJ DESC LIMIT 1),xm.XMYSZEMX) AS XMYSZEMX,
             (select sum(ZZSC*PJRGFY) from kd_ys_ryrgfy where XM_ID = #{xmId}) as ryrgfy,
             (select sum(yong_liang*dan_jia+YSJE+ZLFYYS) from kd_ys_zjtrfy where XM_ID = #{xmId}) as zjtrfy,
-            (select sum(ZZSC*YZJE+CQDTFYYSJE) from kd_ys_zjfyycqdtfy t where XM_ID = #{xmId}) as zjfyycqdtfy,
+            (select sum(ZZSC*(select ifnull(YZJE,0) from kd_asset where id = asset_id)+CQDTFYYSJE) from kd_ys_zjfyycqdtfy t where XM_ID = #{xmId}) as zjfyycqdtfy,
             (select sum(ZZSC*(select ifnull(YZJE,0) from kd_asset where id = asset_id)) from kd_ys_wxzctxfy where XM_ID = #{xmId}) as wxzctxfy,
             (select sum(YSJE) from kd_ys_sjfy where XM_ID = #{xmId}) as sjfy,
             (select sum(YSJE) from kd_ys_zbtsysyfy where XM_ID = #{xmId}) as zbtsysyfy,

+ 1 - 1
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/YsRyrgfyMapper.xml

@@ -29,7 +29,7 @@
     </delete>
 
     <select id="selectYsRyrgfyPage" resultMap="ResultVoMap">
-        select fy.*, t.unicode as 'technician.unicode',t.name as 'technician.name',t.number as 'technician.number',t.id_card as 'technician.id_card', t.nature as 'technician.nature'
+        select fy.*, t.unicode unicode,t.name as 'technician.name',t.number as 'technician.number',t.id_card as 'technician.id_card', t.nature as 'technician.nature'
         from kd_ys_ryrgfy fy
         LEFT JOIN kd_technician t on fy.technician_id = t.id
         WHERE fy.XM_ID = #{ysRyrgfy.xmId}

+ 1 - 1
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/YsZjfyycqdtfyMapper.xml

@@ -37,7 +37,7 @@
 
 
     <select id="selectPageByXmId" resultMap="ResultVoMap">
-        select z.*,s.zcmc
+        select z.*,s.zcmc,s.YZJE
         from kd_ys_zjfyycqdtfy z
         Left join kd_asset s on s.id = z.asset_id
         where z.is_deleted = 0

+ 152 - 4
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/EnterpriseInfoServiceImpl.java

@@ -2,21 +2,31 @@
 package org.sky.scientific.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
 import org.sky.core.log.exception.ServiceException;
 import org.sky.core.mp.base.BaseServiceImpl;
+import org.sky.core.mp.support.Condition;
+import org.sky.core.mp.support.Query;
 import org.sky.core.secure.utils.SecureUtil;
 import org.sky.core.tool.utils.DateUtil;
 import org.sky.core.tool.utils.Func;
 import org.sky.scientific.mapper.*;
+import org.sky.scientific.pojo.dto.CostSummaryDTO;
+import org.sky.scientific.pojo.dto.TechnicianDTO;
+import org.sky.scientific.pojo.dto.XmAssetQueryParam;
 import org.sky.scientific.pojo.entity.*;
 import org.sky.scientific.pojo.vo.*;
 import org.sky.scientific.service.IEnterpriseInfoService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -34,6 +44,12 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 	private final A107012Mapper a107012Mapper;
 	private final A107041Mapper a107041Mapper;
 	private final HighTechYbMapper highTechYbMapper;
+	private final TechnicianMapper technicianMapper;
+	private final AssetMapper assetMapper;
+	private final XmFixedAssetMapper fixedAssetMapper;
+	private final CgZlMapper zlMapper;
+	private final CgKylwMapper kylwMapper;
+	private final CgJsbzMapper jsbzMapper;
 
 	@Override
 	@Transactional
@@ -90,9 +106,7 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 
 	@Override
 	public List<A107_1VO> qyyjkfxmqk(String year) {
-		List<A107_1VO> list = new ArrayList<>();
-		A107_1VO vo = new A107_1VO();
-		list.add(vo);
+		List<A107_1VO> list = a107_1Mapper.qyyjkfxmqk(year, SecureUtil.getTenantId());
 		return list;
 	}
 
@@ -112,7 +126,141 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 
 	@Override
 	public A107_2VO qyyjkfhdjxgfy(String year) {
-		return new A107_2VO();
+
+		A107_2VO vo = new A107_2VO();
+		A107_2 db = a107_2Mapper.selectOne(Wrappers.<A107_2>lambdaQuery().eq(A107_2::getYearAndMonth, year).eq(A107_2::getTenantId, SecureUtil.getTenantId()));
+		if(Func.notNull(db)){
+			vo.setD2(db.getD2());
+			vo.setD58(db.getD58());
+			vo.setD55(db.getD55());
+			vo.setD56(db.getD56());
+			vo.setD45(db.getD45());
+			vo.setD22(db.getD22());
+			vo.setD23(db.getD23());
+			vo.setD24(db.getD24());
+			vo.setD25(db.getD25());
+			vo.setD26(db.getD26());
+			vo.setD53(db.getD53());
+			vo.setD54(db.getD54());
+			vo.setD36(db.getD36());
+			vo.setD37(db.getD37());
+			vo.setD38(db.getD38());
+			vo.setD46(db.getD46());
+			vo.setD47(db.getD47());
+			vo.setD48(db.getD48());
+			vo.setD49(db.getD49());
+			vo.setD50(db.getD50());
+		}
+
+		//一、研究开发人员情况
+		Query query = new Query();
+		query.setCurrent(1);
+		query.setSize(Integer.MAX_VALUE);
+		IPage<TechnicianVO> page = Condition.getPage(query);
+		TechnicianDTO dto = new TechnicianDTO();
+		dto.setYearAndMonth(year);
+		dto.setTenantId(SecureUtil.getTenantId());
+		List<TechnicianVO> technicianVOList = technicianMapper.niandugaokejirenyuanhuizongbiao(page, dto);
+
+		int d1=0, d3=0,d4=0,d5=0,d6=0;
+		if(Func.isNotEmpty(technicianVOList)){
+			d1 = technicianVOList.size();
+
+			d3 = (int)technicianVOList.stream().filter(item -> item.getGender()==2).count();
+
+			d5 = (int)technicianVOList.stream().filter(item -> List.of("本科", "硕士研究生", "博士研究生").contains(item.getEducation())).count();
+ 		}
+		vo.setD1(d1);
+		vo.setD3(d3);
+		vo.setD4(d4);
+		vo.setD5(d5);
+		vo.setD6(d6);
+
+		//二、研究开发费用情况
+		CostSummaryDTO costSummaryDTO = new CostSummaryDTO();
+
+ 		costSummaryDTO.setStartYearMonth(year + "01");
+		costSummaryDTO.setMonthCount(12);
+		costSummaryDTO.setTenantId(SecureUtil.getTenantId());
+		List<CostSummaryVO> list = assetMapper.costSummary(costSummaryDTO);
+		for (CostSummaryVO costSummaryVO : list) {
+
+			costSummaryVO.setWwfyAdjust(costSummaryVO.getWwfy().multiply(new BigDecimal("0.8")).setScale(2, RoundingMode.HALF_UP));
+
+			costSummaryVO.setTotal(costSummaryVO.getRyrgfy().add(costSummaryVO.getZjtrfy()).add(costSummaryVO.getZjfyycqdtfy()).add(costSummaryVO.getSjfy()).add(costSummaryVO.getWxzctxfy()).add(costSummaryVO.getZbtsfyysyfy()).add(costSummaryVO.getQtfy()).add(costSummaryVO.getWwfyAdjust()).setScale(2, RoundingMode.HALF_UP));
+
+			vo.setD8(vo.getD8().add(costSummaryVO.getRyrgfy()));
+			vo.setD9(vo.getD9().add(costSummaryVO.getZjtrfy()));
+			vo.setD10(vo.getD10().add(costSummaryVO.getZjfyycqdtfy()));
+			vo.setD11(vo.getD11().add(costSummaryVO.getWxzctxfy()));
+			vo.setD12(vo.getD12().add(costSummaryVO.getSjfy()));
+			vo.setD13(vo.getD13().add(costSummaryVO.getZbtsfyysyfy()));
+			vo.setD14(vo.getD14().add(costSummaryVO.getWwfy()));
+		}
+
+		//换算成千元
+		vo.setD8(vo.getD8().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
+		vo.setD9(vo.getD9().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
+		vo.setD10(vo.getD10().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
+		vo.setD11(vo.getD11().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
+		vo.setD12(vo.getD12().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
+		vo.setD13(vo.getD13().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
+		vo.setD14(vo.getD14().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
+
+		List<A107_1> d43List = a107_1Mapper.selectList(Wrappers.<A107_1>lambdaQuery().eq(A107_1::getYearAndMonth, year));
+ 		for (A107_1 a1071 : d43List) {
+			vo.setD43(vo.getD43().add(a1071.getGovBonus()));
+		}
+		vo.setD43(vo.getD43().setScale(2, RoundingMode.HALF_UP));
+
+
+
+		IPage<XmFixedAsset> p2 = Condition.getPage(query);
+		XmAssetQueryParam param = new XmAssetQueryParam();
+		param.setYearAndMonth(year+"12");
+		List<XmFixedAsset> yiqishebeiList = fixedAssetMapper.selectXmFixedAssetPageByYearAndMonth(p2, param, "仪器设备");
+		for (XmFixedAsset asset : yiqishebeiList) {
+			vo.setD27(vo.getD7().add(asset.getAsset().getZcyz()));
+		}
+		vo.setD27(vo.getD27().setScale(2, RoundingMode.HALF_UP));
+
+		//七、研究开发产出及相关情况
+		List<CgZlEntity> zlList = zlMapper.selectList(Wrappers.<CgZlEntity>lambdaQuery().eq(CgZlEntity::getTenantId, SecureUtil.getTenantId()));
+
+		int d29=0,d30=0,d32=0;
+		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)){
+				d29 ++;
+				if(Func.equals(year ,DateUtil.format(shenqingRq, DateUtil.PATTERN_YYYY))){
+					d30 ++;
+				}
+			}
+
+			if(Func.notNull(shouquanRq) && shouquanRq.before(dateMax) && shouquanRq.after(dateMin)){
+				d32 ++;
+			}
+		}
+		vo.setD29(d29);
+		vo.setD30(d30);
+		vo.setD32(d32);
+		vo.setD33(vo.getD32());
+
+
+		Long d40 = kylwMapper.selectCount(Wrappers.<CgKylwEntity>lambdaQuery().between(CgKylwEntity::getFbrq, dateMin, dateMax));
+		vo.setD40(Func.toInt(d40, 0));
+
+ 		Long d41 = jsbzMapper.selectCount(Wrappers.<CgJsbzEntity>lambdaQuery()
+			.between(CgJsbzEntity::getSsrq, dateMin, dateMax)
+			.eq(CgJsbzEntity::getState, "现行有效")
+			.in(CgJsbzEntity::getBzlb, List.of("国家标准", "行业标准")));
+		vo.setD41(Func.toInt(d41, 0));
+
+
+		return vo;
 	}
 
 	@Override

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

@@ -212,7 +212,7 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
 		List<XmEntity> xmList = xmMapper.listByYearAndMonth(yearAndMonth);
 		Date lastDate = DateUtil.minusMonths(DateUtil.parse(yearAndMonth, DateUtil.PATTERN_YYYYMM), 1);
 		for (XmEntity xm : xmList) {
-			//根据项目引入上个月的参研人员名单(基础信息)
+			//根据项目引入上个月的参研人员名单
 			LambdaQueryWrapper<XmTechnicianEntity> wrapper = Wrappers.<XmTechnicianEntity>lambdaQuery()
 				.eq(XmTechnicianEntity::getXmId, xm.getId())
 				.eq(XmTechnicianEntity::getYearAndMonth, DateUtil.format(lastDate, DateUtil.PATTERN_YYYYMM));
@@ -348,6 +348,7 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
 	@Override
 	public IPage<TechnicianVO> niandugaokejirenyuanhuizongbiao(IPage<TechnicianVO> page, TechnicianDTO dto) {
 		//TODO 目前因测试数据不多,需求是 年度天数大于183的才显示,这里先用18代替,后期要改回来
+		dto.setTenantId(SecureUtil.getTenantId());
 		List<TechnicianVO> list = baseMapper.niandugaokejirenyuanhuizongbiao(page, dto);
 		for (TechnicianVO vo : list) {
 			vo.setGenderName(DictCache.getValue(DictEnum.SEX, vo.getGender()));