|
|
@@ -1,6 +1,8 @@
|
|
|
|
|
|
package org.sky.scientific.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
@@ -13,17 +15,17 @@ 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.dto.*;
|
|
|
import org.sky.scientific.pojo.entity.*;
|
|
|
import org.sky.scientific.pojo.vo.*;
|
|
|
import org.sky.scientific.service.IEnterpriseInfoService;
|
|
|
+import org.sky.scientific.service.IXmCostDetailsService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -51,6 +53,10 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
private final CgRjzzqMapper rjzzqMapper;
|
|
|
private final CgQtMapper qtMapper;
|
|
|
private final ArchiveAttachMapper attachMapper;
|
|
|
+ private final XmWwxmCostMapper wwxmCostMapper;
|
|
|
+ private final IXmCostDetailsService xmCostDetailsService;
|
|
|
+ private final EnterpriseInfoMapper enterpriseInfoMapper;
|
|
|
+ private final XmMapper xmMapper;
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
@@ -96,7 +102,7 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
|
|
|
if (Func.isNull(one)) {
|
|
|
//新增
|
|
|
- result = this.save(enterpriseInfo);
|
|
|
+ result = this.save(enterpriseInfo);
|
|
|
} else {
|
|
|
//修改
|
|
|
enterpriseInfo.setId(one.getId());
|
|
|
@@ -114,6 +120,35 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
throw new ServiceException("参数year为年份,如2025");
|
|
|
}
|
|
|
List<A107_1VO> list = a107_1Mapper.qyyjkfxmqk(year, SecureUtil.getTenantId());
|
|
|
+ for (A107_1VO vo : list) {
|
|
|
+
|
|
|
+// TODO 项目人员实际工作时间(人月)
|
|
|
+
|
|
|
+ //当列15等于基础研究时,列14=P088中对应研发项目的受托方类型的前5项的委外金额合计。当列15不等于基础研究时,列14等于0
|
|
|
+ if (Func.equals(vo.getYjlx(), "基础研究")) {
|
|
|
+ //对应研发项目的受托方类型的前5项的委外金额合计
|
|
|
+ vo.setWwfy(wwxmCostMapper.getAmountByXmAndYear(year, vo.getXmId()));
|
|
|
+
|
|
|
+ XmCostDetailsDTO dto = new XmCostDetailsDTO();
|
|
|
+ dto.setXmId(vo.getXmId());
|
|
|
+ dto.setYearAndMonth(year + "12");
|
|
|
+ List<FinanceCostSummary> summaryList = xmCostDetailsService.financeCostSummary(Condition.getPage(new Query().setCurrent(1).setSize(1)), dto).getRecords();
|
|
|
+ if (Func.isEmpty(summaryList)) {
|
|
|
+ vo.setCost(BigDecimal.ZERO);
|
|
|
+ vo.setCost1(BigDecimal.ZERO);
|
|
|
+ } else {
|
|
|
+ FinanceCostSummary summary = summaryList.get(0);
|
|
|
+ vo.setCost(summary.getTotal());
|
|
|
+ vo.setCost1(summary.getTotal());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ vo.setCost(BigDecimal.ZERO);
|
|
|
+ vo.setCost1(BigDecimal.ZERO);
|
|
|
+ vo.setWwfy(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ //其中:企业自主开展=用于科学原理的探索发现的经费总额-委托外单位开展
|
|
|
+ vo.setCost2(vo.getCost1().subtract(vo.getWwfy()));
|
|
|
+ }
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
@@ -168,10 +203,7 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
}
|
|
|
|
|
|
//一、研究开发人员情况
|
|
|
- Query query = new Query();
|
|
|
- query.setCurrent(1);
|
|
|
- query.setSize(Integer.MAX_VALUE);
|
|
|
- IPage<TechnicianVO> page = Condition.getPage(query);
|
|
|
+ IPage<TechnicianVO> page = Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE));
|
|
|
TechnicianDTO dto = new TechnicianDTO();
|
|
|
dto.setYearAndMonth(year);
|
|
|
dto.setTenantId(SecureUtil.getTenantId());
|
|
|
@@ -199,11 +231,8 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
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()));
|
|
|
@@ -211,25 +240,64 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
vo.setD12(vo.getD12().add(costSummaryVO.getSjfy()));
|
|
|
vo.setD13(vo.getD13().add(costSummaryVO.getZbtsfyysyfy()));
|
|
|
vo.setD14(vo.getD14().add(costSummaryVO.getWwfy()));
|
|
|
+ vo.setD19(vo.getD19().add(costSummaryVO.getQtfy()));
|
|
|
}
|
|
|
|
|
|
//换算成千元
|
|
|
+ //1.人员人工费用
|
|
|
vo.setD8(vo.getD8().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //2.直接投入费用
|
|
|
vo.setD9(vo.getD9().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //3.折旧费用与长期待摊费用
|
|
|
vo.setD10(vo.getD10().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //4.无形资产摊销费用
|
|
|
vo.setD11(vo.getD11().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //5.设计费用
|
|
|
vo.setD12(vo.getD12().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //6.装备调试费用与试验费用
|
|
|
vo.setD13(vo.getD13().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //7.委托外部研究开发费用
|
|
|
vo.setD14(vo.getD14().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
-
|
|
|
+ //8.其他费用
|
|
|
+ vo.setD19(vo.getD19().multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+
|
|
|
+ XmWwxmCostQuery wwxmCostQuery = new XmWwxmCostQuery();
|
|
|
+ wwxmCostQuery.setYearAndMonth(year);
|
|
|
+ List<XmWwxmCostVO> wwxmCostVOList = wwxmCostMapper.selectPageByYear(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), wwxmCostQuery);
|
|
|
+
|
|
|
+ //①委托境内研究机构
|
|
|
+ BigDecimal d15 = wwxmCostVOList.stream().filter(item -> Func.equals(item.getStflx(), "境内研究机构")).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
|
|
+ vo.setD15(d15.multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //②委托境内高等学校
|
|
|
+ BigDecimal d16 = wwxmCostVOList.stream().filter(item -> Func.equals(item.getStflx(), "境内高等学校")).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
|
|
+ vo.setD16(d16.multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //③委托境内企业
|
|
|
+ BigDecimal d17 = wwxmCostVOList.stream().filter(item -> Func.equals(item.getStflx(), "境内企业")).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
|
|
+ vo.setD17(d17.multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //④委托境外机构
|
|
|
+ BigDecimal d18 = wwxmCostVOList.stream().filter(item -> Func.equals(item.getStflx(), "境外机构")).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
|
|
+ vo.setD18(d18.multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+
|
|
|
+ // todo 三、研究开发资产情况
|
|
|
+ // d20 当年形成用于研发开发的固定资产
|
|
|
+
|
|
|
+ // d21 其中:仪器和设备
|
|
|
+
|
|
|
+ //四、研究开发支出资金来源
|
|
|
+ //2.来自政府部门
|
|
|
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);
|
|
|
+ //六、企业办研究开发机构 (境内)情况
|
|
|
+ // d27 :期末仪器和设备原价
|
|
|
+ IPage<XmFixedAsset> p2 = Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE));
|
|
|
XmAssetQueryParam param = new XmAssetQueryParam();
|
|
|
param.setYearAndMonth(year + "12");
|
|
|
List<XmFixedAsset> yiqishebeiList = fixedAssetMapper.selectXmFixedAssetPageByYearAndMonth(p2, param, "仪器设备");
|
|
|
@@ -263,7 +331,6 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
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));
|
|
|
|
|
|
@@ -273,6 +340,22 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
.in(CgJsbzEntity::getBzlb, List.of("国家标准", "行业标准")));
|
|
|
vo.setD41(Func.toInt(d41, 0));
|
|
|
|
|
|
+ //八、其他相关情况
|
|
|
+ //当年企业研发准备金合计
|
|
|
+ List<XmEntity> xmList = xmMapper.selectList(Wrappers.emptyWrapper());
|
|
|
+ BigDecimal d59 = BigDecimal.ZERO;
|
|
|
+ for (XmEntity xm : xmList) {
|
|
|
+ String xmyszemx = xm.getXmyszemx();
|
|
|
+ if (Func.notNull(xmyszemx)) {
|
|
|
+ List<JSONObject> array = JSON.parseArray(xmyszemx, JSONObject.class);
|
|
|
+ double sum = array.stream().filter(item -> item.getInteger("year") == Integer.parseInt(year)).mapToDouble(item -> item.getDouble("amount")).sum();
|
|
|
+ System.out.println("sum:"+sum);
|
|
|
+ vo.setD59(vo.getD59().add(BigDecimal.valueOf(sum)));
|
|
|
+ System.out.println("d59:"+vo.getD59());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //预算的单位是万,这里要显示千元,故乘以10即可,即1万=10千元
|
|
|
+ vo.setD59(vo.getD59().multiply(new BigDecimal("10")).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
|
return vo;
|
|
|
}
|
|
|
@@ -308,7 +391,6 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
d46 = one.getD46();
|
|
|
d48 = one.getD48();
|
|
|
d49 = one.getD49();
|
|
|
-
|
|
|
}
|
|
|
vo.setD43(d43);
|
|
|
vo.setD44(d44);
|
|
|
@@ -316,6 +398,66 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
vo.setD48(d48);
|
|
|
vo.setD49(d49);
|
|
|
|
|
|
+ XmCostDetailsDTO costDetailsDTO = new XmCostDetailsDTO();
|
|
|
+ costDetailsDTO.setYearAndMonth(year + "12");
|
|
|
+ DeductionCostSummary summary = xmCostDetailsService.deductionCostSummary(costDetailsDTO);
|
|
|
+
|
|
|
+ vo.setD1(Func.isNull(summary) ? 0 : (int) summary.getItemList().stream().map(DeductionCostSummaryItem::getXmId).distinct().count());
|
|
|
+ //(一)人员人工费用(4+5+6)
|
|
|
+ vo.setD3(Func.isNull(summary) ? BigDecimal.ZERO : summary.getRyrgfy_hjje());
|
|
|
+ //(二)直接投入费用(8+9+10+11+12+13+14+15)
|
|
|
+ vo.setD7(Func.isNull(summary) ? BigDecimal.ZERO : summary.getZjtrfy_hjje());
|
|
|
+ //(三)折旧费用(17+18)
|
|
|
+ vo.setD16(Func.isNull(summary) ? BigDecimal.ZERO : summary.getZjfy_hjje());
|
|
|
+ //(四)无形资产摊销(20+21+22)
|
|
|
+ vo.setD19(Func.isNull(summary) ? BigDecimal.ZERO : summary.getWxzctx_hjje());
|
|
|
+ //(五)新产品设计费
|
|
|
+ vo.setD23(Func.isNull(summary) ? BigDecimal.ZERO : summary.getXcpsjfd_hjje());
|
|
|
+ //(六)其他相关费用
|
|
|
+ vo.setD28(Func.isNull(summary) ? BigDecimal.ZERO : summary.getQtxgfyhj_hjje());
|
|
|
+ //(七)经限额调整后的其他相关费用
|
|
|
+ vo.setD34(Func.isNull(summary) ? BigDecimal.ZERO : summary.getQtxgfyhj_adjust_hjje());
|
|
|
+
|
|
|
+ //一、自主研发、合作研发、集中研发(3+7+16+19+23+34)
|
|
|
+ vo.setD2(vo.getD3().add(vo.getD7()).add(vo.getD16()).add(vo.getD19()).add(vo.getD23()).add(vo.getD28()).add(vo.getD34()));
|
|
|
+
|
|
|
+ //二、委托研发(36+37+39)
|
|
|
+ //(一)委托境内机构或个人进行研发活动所发生的费用
|
|
|
+ vo.setD36(Func.isNull(summary) ? BigDecimal.ZERO : summary.getWtjnjgfy_hjje());
|
|
|
+ //(二)委托境外机构进行研发活动发生的费用
|
|
|
+ vo.setD37(Func.isNull(summary) ? BigDecimal.ZERO : summary.getWtjwjgfy_hjje());
|
|
|
+ //其中:允许加计扣除的委托境外机构进行研发活动发生的费用
|
|
|
+ vo.setD38(Func.isNull(summary) ? BigDecimal.ZERO : summary.getWtjwjgfy_adjust_hjje());
|
|
|
+ //(三)委托境外个人进行研发活动发生的费用
|
|
|
+ XmWwxmCostQuery wwxmCostQuery = new XmWwxmCostQuery();
|
|
|
+ wwxmCostQuery.setYearAndMonth(year);
|
|
|
+ List<XmWwxmCostVO> wwxmCostVOList1 = wwxmCostMapper.selectPageByYear(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), wwxmCostQuery);
|
|
|
+ vo.setD39(wwxmCostVOList1.stream().filter(t -> "境外个人".equalsIgnoreCase(t.getStflx())).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD35(vo.getD36().add(vo.getD37()).add(vo.getD39()));
|
|
|
+
|
|
|
+ //三、年度研发费用小计(2+36×80%+38)
|
|
|
+ //(一)本年费用化金额
|
|
|
+ vo.setD41(Func.isNull(summary) ? BigDecimal.ZERO : summary.getTotal_fyh());
|
|
|
+ //(二)本年资本化金额
|
|
|
+ vo.setD42(Func.isNull(summary) ? BigDecimal.ZERO : summary.getTotal_zbh());
|
|
|
+
|
|
|
+ //一、自主研发、合作研发、集中研发(3+7+16+19+23+34)
|
|
|
+ vo.setD2(vo.getD3().add(vo.getD7()).add(vo.getD16()).add(vo.getD19()).add(vo.getD23()).add(vo.getD34()));
|
|
|
+
|
|
|
+ //三、年度研发费用小计(2+36×80%+38)
|
|
|
+ vo.setD40(vo.getD2().add(vo.getD36().multiply(new BigDecimal("0.8"))).add(vo.getD38()));
|
|
|
+
|
|
|
+ //六、允许扣除的研发费用合计(41+43+44)
|
|
|
+ vo.setD45(vo.getD41().add(vo.getD43()).add(vo.getD44()));
|
|
|
+
|
|
|
+ //七、允许扣除的研发费用抵减特殊收入后的金额(45-46)
|
|
|
+ vo.setD47(vo.getD45().subtract(vo.getD46()));
|
|
|
+
|
|
|
+ //九、本年研发费用加计扣除总额(47-48-49)×50,50为固定的100%
|
|
|
+ vo.setD51((vo.getD47().subtract(vo.getD48()).subtract(vo.getD49())));
|
|
|
+
|
|
|
+ //十、销售研发活动直接形成产品(包括组成部分)对应材料部分转移以后年度扣减金额(当47-48-49≥0,本行=0;当47-48-49<0,本行=47-48-49的绝对值)
|
|
|
+ vo.setD52(vo.getD51().compareTo(BigDecimal.ZERO) > 0 ? BigDecimal.ZERO : vo.getD51().abs());
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
@@ -343,6 +485,16 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
|
|
|
A107041VO vo = new A107041VO();
|
|
|
|
|
|
+ //国家重点支持的高新技术领域
|
|
|
+ EnterpriseInfoEntity enterpriseInfo = enterpriseInfoMapper.selectOne(Wrappers.<EnterpriseInfoEntity>lambdaQuery()
|
|
|
+ .eq(EnterpriseInfoEntity::getYearAndMonth, year)
|
|
|
+ .eq(EnterpriseInfoEntity::getTenantId, SecureUtil.getTenantId()));
|
|
|
+ if (Func.notNull(enterpriseInfo)) {
|
|
|
+ vo.setD1(enterpriseInfo.getHighTechDomainL1());
|
|
|
+ vo.setD2(enterpriseInfo.getHighTechDomainL2());
|
|
|
+ vo.setD3(enterpriseInfo.getHighTechDomainL3());
|
|
|
+ }
|
|
|
+
|
|
|
A107041 one = a107041Mapper.selectOne(Wrappers.<A107041>lambdaQuery().eq(A107041::getYearAndMonth, year));
|
|
|
|
|
|
BigDecimal d5 = new BigDecimal("0.00"), d6 = new BigDecimal("0.00"), d8 = new BigDecimal("0.00"), d9 = new BigDecimal("0.00");
|
|
|
@@ -355,14 +507,167 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
|
|
|
d8 = one.getD8();
|
|
|
d9 = one.getD9();
|
|
|
d12 = one.getD12();
|
|
|
- d29_1 = one.getD29_1();
|
|
|
- d29_2 = one.getD29_2();
|
|
|
- d29_3 = one.getD29_3();
|
|
|
+ d29_1 = one.getD2901();
|
|
|
+ d29_2 = one.getD2902();
|
|
|
+ d29_3 = one.getD2903();
|
|
|
d31 = one.getD31();
|
|
|
d32 = one.getD32();
|
|
|
}
|
|
|
|
|
|
+ vo.setD5(d5);
|
|
|
+ vo.setD6(d6);
|
|
|
+ vo.setD4(vo.getD5().add(vo.getD6()));
|
|
|
+ vo.setD8(d8);
|
|
|
+ vo.setD9(d9);
|
|
|
+ vo.setD7(vo.getD6().subtract(vo.getD9()));
|
|
|
|
|
|
+ vo.setD10(vo.getD7().doubleValue() == 0 ? BigDecimal.ZERO : vo.getD4().divide(vo.getD7()));
|
|
|
+
|
|
|
+ //四、本年科技人员数
|
|
|
+ IPage<TechnicianVO> page = Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE));
|
|
|
+ TechnicianDTO dto = new TechnicianDTO();
|
|
|
+ dto.setYearAndMonth(year);
|
|
|
+ dto.setTenantId(SecureUtil.getTenantId());
|
|
|
+ List<TechnicianVO> technicianVOList = technicianMapper.niandugaokejirenyuanhuizongbiao(page, dto);
|
|
|
+ vo.setD11(Func.isEmpty(technicianVOList) ? 0 : technicianVOList.size());
|
|
|
+ //五、本年职工总数
|
|
|
+ vo.setD12(d12);
|
|
|
+ //六、本年科技人员占企业当年职工总数的比例(11÷12)
|
|
|
+ vo.setD13(vo.getD12() == 0 ? BigDecimal.ZERO : BigDecimal.valueOf((vo.getD11() * 1.0) / vo.getD12()));
|
|
|
+
|
|
|
+ XmCostDetailsDTO xmCostDetailsDTO = new XmCostDetailsDTO();
|
|
|
+ xmCostDetailsDTO.setYearAndMonth(year + "12");
|
|
|
+ List<HighTechCostSummary> summaryList1 = xmCostDetailsService.highTechCostSummary(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), xmCostDetailsDTO).getRecords();
|
|
|
+
|
|
|
+ xmCostDetailsDTO = new XmCostDetailsDTO();
|
|
|
+ xmCostDetailsDTO.setYearAndMonth(Integer.parseInt(year) - 1 + "12");
|
|
|
+ List<HighTechCostSummary> summaryList2 = xmCostDetailsService.highTechCostSummary(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), xmCostDetailsDTO).getRecords();
|
|
|
+
|
|
|
+ xmCostDetailsDTO = new XmCostDetailsDTO();
|
|
|
+ xmCostDetailsDTO.setYearAndMonth(Integer.parseInt(year) - 2 + "12");
|
|
|
+ List<HighTechCostSummary> summaryList3 = xmCostDetailsService.highTechCostSummary(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), xmCostDetailsDTO).getRecords();
|
|
|
+
|
|
|
+ //七、归集的高新研发费用金额(16+25)
|
|
|
+ //一)内部研究开发投入
|
|
|
+ //1.人员人工费用
|
|
|
+ vo.setD17_1(summaryList1.stream().map(HighTechCostSummary::getRyrgTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD17_2(summaryList2.stream().map(HighTechCostSummary::getRyrgTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD17_3(summaryList3.stream().map(HighTechCostSummary::getRyrgTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD17_4(vo.getD17_1().add(vo.getD17_2()).add(vo.getD17_3()));
|
|
|
+
|
|
|
+ //2.直接投入费用
|
|
|
+ vo.setD18_1(summaryList1.stream().map(HighTechCostSummary::getZjtrTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD18_2(summaryList2.stream().map(HighTechCostSummary::getZjtrTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD18_3(summaryList3.stream().map(HighTechCostSummary::getZjtrTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD18_4(vo.getD18_1().add(vo.getD18_2()).add(vo.getD18_3()));
|
|
|
+
|
|
|
+ //3.折旧费用与长期待摊费用
|
|
|
+ vo.setD19_1(summaryList1.stream().map(HighTechCostSummary::getZjfyycqdtfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD19_2(summaryList2.stream().map(HighTechCostSummary::getZjfyycqdtfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD19_3(summaryList3.stream().map(HighTechCostSummary::getZjfyycqdtfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD19_4(vo.getD19_1().add(vo.getD19_2()).add(vo.getD19_3()));
|
|
|
+
|
|
|
+ //4.无形资产摊销费用
|
|
|
+ vo.setD20_1(summaryList1.stream().map(HighTechCostSummary::getWxzctxTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD20_2(summaryList2.stream().map(HighTechCostSummary::getWxzctxTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD20_3(summaryList3.stream().map(HighTechCostSummary::getWxzctxTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD20_4(vo.getD20_1().add(vo.getD20_2()).add(vo.getD20_3()));
|
|
|
+
|
|
|
+ //5.设计费用
|
|
|
+ vo.setD21_1(summaryList1.stream().map(HighTechCostSummary::getSjfTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD21_2(summaryList2.stream().map(HighTechCostSummary::getSjfTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD21_3(summaryList3.stream().map(HighTechCostSummary::getSjfTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD21_4(vo.getD21_1().add(vo.getD21_2()).add(vo.getD21_3()));
|
|
|
+
|
|
|
+ //6.设备调试费与实验费用
|
|
|
+ vo.setD22_1(summaryList1.stream().map(HighTechCostSummary::getZbtsfyysyfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD22_2(summaryList2.stream().map(HighTechCostSummary::getZbtsfyysyfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD22_3(summaryList3.stream().map(HighTechCostSummary::getZbtsfyysyfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD22_4(vo.getD22_1().add(vo.getD22_2()).add(vo.getD22_3()));
|
|
|
+
|
|
|
+ //7.其他费用
|
|
|
+ vo.setD23_1(summaryList1.stream().map(HighTechCostSummary::getQtfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD23_2(summaryList2.stream().map(HighTechCostSummary::getQtfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD23_3(summaryList3.stream().map(HighTechCostSummary::getQtfyTotal).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD23_4(vo.getD23_1().add(vo.getD23_2()).add(vo.getD23_3()));
|
|
|
+
|
|
|
+ //其中:可计入研发费用的其他费用
|
|
|
+
|
|
|
+ vo.setD24_1(summaryList1.stream().map(HighTechCostSummary::getQtfyAdjust).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD24_2(summaryList2.stream().map(HighTechCostSummary::getQtfyAdjust).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD24_3(summaryList3.stream().map(HighTechCostSummary::getQtfyAdjust).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ vo.setD24_4(vo.getD24_1().add(vo.getD24_2()).add(vo.getD24_3()));
|
|
|
+
|
|
|
+ XmWwxmCostQuery wwxmCostQuery = new XmWwxmCostQuery();
|
|
|
+ wwxmCostQuery.setYearAndMonth(year);
|
|
|
+ List<XmWwxmCostVO> wwxmCostVOList1 = wwxmCostMapper.selectPageByYear(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), wwxmCostQuery);
|
|
|
+
|
|
|
+ wwxmCostQuery = new XmWwxmCostQuery();
|
|
|
+ wwxmCostQuery.setYearAndMonth(Integer.parseInt(year) - 1 + "12");
|
|
|
+ List<XmWwxmCostVO> wwxmCostVOList2 = wwxmCostMapper.selectPageByYear(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), wwxmCostQuery);
|
|
|
+
|
|
|
+ wwxmCostQuery = new XmWwxmCostQuery();
|
|
|
+ wwxmCostQuery.setYearAndMonth(Integer.parseInt(year) - 2 + "12");
|
|
|
+ List<XmWwxmCostVO> wwxmCostVOList3 = wwxmCostMapper.selectPageByYear(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), wwxmCostQuery);
|
|
|
+
|
|
|
+ //二)委托外部研发费用【(26+28)×80%】
|
|
|
+ //1.境内的外部研发费
|
|
|
+ BigDecimal d26_1 = wwxmCostVOList1.stream().filter(t -> Arrays.asList("境内研究机构", "境内高等学校", "境内企业", "境内个人").contains(t.getStflx())).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo.setD26_1(d26_1);
|
|
|
+ BigDecimal d26_2 = wwxmCostVOList2.stream().filter(t -> Arrays.asList("境内研究机构", "境内高等学校", "境内企业", "境内个人").contains(t.getStflx())).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo.setD26_2(d26_2);
|
|
|
+ BigDecimal d26_3 = wwxmCostVOList3.stream().filter(t -> Arrays.asList("境内研究机构", "境内高等学校", "境内企业", "境内个人").contains(t.getStflx())).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo.setD26_3(d26_3);
|
|
|
+ vo.setD26_4(vo.getD26_1().add(vo.getD26_2()).add(vo.getD26_3()));
|
|
|
+ //2.境外的外部研发费
|
|
|
+ BigDecimal d27_1 = wwxmCostVOList1.stream().filter(t -> Arrays.asList("境外机构", "境外个人").contains(t.getStflx())).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo.setD27_1(d27_1);
|
|
|
+ BigDecimal d27_2 = wwxmCostVOList2.stream().filter(t -> Arrays.asList("境外机构", "境外个人").contains(t.getStflx())).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo.setD27_2(d27_2);
|
|
|
+ BigDecimal d27_3 = wwxmCostVOList3.stream().filter(t -> Arrays.asList("境外机构", "境外个人").contains(t.getStflx())).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo.setD27_3(d27_3);
|
|
|
+ vo.setD27_4(vo.getD27_1().add(vo.getD27_2()).add(vo.getD27_3()));
|
|
|
+
|
|
|
+ XmCostDetailsDTO costDetailsDTO = new XmCostDetailsDTO();
|
|
|
+ costDetailsDTO.setYearAndMonth(year + "12");
|
|
|
+ DeductionCostSummary summary = xmCostDetailsService.deductionCostSummary(costDetailsDTO);
|
|
|
+ vo.setD28_1(Func.isNull(summary) ? BigDecimal.ZERO : summary.getWtjwjgfy_adjust_hjje());
|
|
|
+
|
|
|
+ costDetailsDTO.setYearAndMonth((Integer.parseInt(year) - 1) + "12");
|
|
|
+ summary = xmCostDetailsService.deductionCostSummary(costDetailsDTO);
|
|
|
+ vo.setD28_2(Func.isNull(summary) ? BigDecimal.ZERO : summary.getWtjwjgfy_adjust_hjje());
|
|
|
+
|
|
|
+ costDetailsDTO.setYearAndMonth((Integer.parseInt(year) - 2) + "12");
|
|
|
+ summary = xmCostDetailsService.deductionCostSummary(costDetailsDTO);
|
|
|
+ vo.setD28_3(Func.isNull(summary) ? BigDecimal.ZERO : summary.getWtjwjgfy_adjust_hjje());
|
|
|
+
|
|
|
+ vo.setD28_4(vo.getD28_1().add(vo.getD28_2()).add(vo.getD28_3()));
|
|
|
+
|
|
|
+ vo.setD15_1(vo.getD16_1().add(vo.getD25_1()));
|
|
|
+ vo.setD15_2(vo.getD16_2().add(vo.getD25_2()));
|
|
|
+ vo.setD15_3(vo.getD16_3().add(vo.getD25_3()));
|
|
|
+ vo.setD15_4(vo.getD15_1().add(vo.getD15_2()).add(vo.getD15_3()));
|
|
|
+
|
|
|
+ vo.setD16_1(vo.getD17_1().add(vo.getD18_1()).add(vo.getD19_1()).add(vo.getD20_1()).add(vo.getD21_1()).add(vo.getD22_1()).add(vo.getD23_1()).add(vo.getD24_1()));
|
|
|
+ vo.setD16_2(vo.getD17_2().add(vo.getD18_2()).add(vo.getD19_2()).add(vo.getD20_2()).add(vo.getD21_2()).add(vo.getD22_2()).add(vo.getD23_2()).add(vo.getD24_2()));
|
|
|
+ vo.setD16_3(vo.getD17_3().add(vo.getD18_3()).add(vo.getD19_3()).add(vo.getD20_3()).add(vo.getD21_3()).add(vo.getD22_3()).add(vo.getD23_3()).add(vo.getD24_3()));
|
|
|
+ vo.setD16_4(vo.getD16_1().add(vo.getD16_2()).add(vo.getD16_3()));
|
|
|
+
|
|
|
+ vo.setD25_1(vo.getD26_1().add(vo.getD28_1().multiply(BigDecimal.valueOf(0.8))));
|
|
|
+ vo.setD25_2(vo.getD26_2().add(vo.getD28_2().multiply(BigDecimal.valueOf(0.8))));
|
|
|
+ vo.setD25_3(vo.getD26_3().add(vo.getD28_3().multiply(BigDecimal.valueOf(0.8))));
|
|
|
+ vo.setD25_4(vo.getD25_1().add(vo.getD25_2()).add(vo.getD25_3()));
|
|
|
+
|
|
|
+ vo.setD2901(d29_1);
|
|
|
+ vo.setD2902(d29_2);
|
|
|
+ vo.setD2903(d29_3);
|
|
|
+ vo.setD2904(vo.getD2901().add(vo.getD2902()).add(vo.getD2903()));
|
|
|
+
|
|
|
+ //九、三年研发费用占销售(营业)收入的比例(15行第4列/29行第4列)
|
|
|
+ vo.setD30((vo.getD2904().compareTo(BigDecimal.ZERO) == 0) ? BigDecimal.ZERO : vo.getD15_4().divide(vo.getD2904()));
|
|
|
+
|
|
|
+ vo.setD31(d31);
|
|
|
+ vo.setD32(d32);
|
|
|
return vo;
|
|
|
}
|
|
|
|