zhoulisky 8 months ago
parent
commit
7685abb904

+ 0 - 4
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/dto/XmAssetQueryParam.java

@@ -63,12 +63,8 @@ public class XmAssetQueryParam {
 	private Double workHoursMax;
 	private Double workHoursMax;
 
 
 	@Schema(description = "开始时间-小")
 	@Schema(description = "开始时间-小")
-//	@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
-//	@JsonFormat(pattern = DateUtil.PATTERN_DATE)
 	private String kssjMin;
 	private String kssjMin;
 	@Schema(description = "开始时间-大")
 	@Schema(description = "开始时间-大")
-//	@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
-//	@JsonFormat(pattern = DateUtil.PATTERN_DATE)
 	private String kssjMax;
 	private String kssjMax;
 
 
 }
 }

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

@@ -163,7 +163,7 @@
         <if test="ew.practicingRequirement !=null and ew.practicingRequirement!=''">and t.practicing_requirement like concat('%',#{ew.practicingRequirement}, '%')</if>
         <if test="ew.practicingRequirement !=null and ew.practicingRequirement!=''">and t.practicing_requirement like concat('%',#{ew.practicingRequirement}, '%')</if>
         <if test="ew.hireDateMin!=null and ew.hireDateMax!=''">and hire_Date between #{ew.hireDateMin} and #{ew.hireDateMax}</if>
         <if test="ew.hireDateMin!=null and ew.hireDateMax!=''">and hire_Date between #{ew.hireDateMin} and #{ew.hireDateMax}</if>
         GROUP BY h.unicode
         GROUP BY h.unicode
-        HAVING workDaysByYear > 18
+        HAVING workDaysByYear > 183
     </select>
     </select>
 
 
     <select id="getNameById" resultType="java.lang.String">
     <select id="getNameById" resultType="java.lang.String">

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

@@ -66,7 +66,7 @@
     </select>
     </select>
 
 
     <select id="selectXmFixedAssetPageByYear" resultMap="ResultMap">
     <select id="selectXmFixedAssetPageByYear" resultMap="ResultMap">
-        SELECT xa.xm_id, xa.asset_id, <include refid="org.sky.scientific.mapper.AssetMapper.basicColumns"/>
+        SELECT xa.xm_id, xm.XMBH as xmbh, xm.XMMC as xmmc, xa.asset_id, xa.zcbm, <include refid="org.sky.scientific.mapper.AssetMapper.basicColumns"/>
         FROM kd_xm_fixed_asset xa
         FROM kd_xm_fixed_asset xa
         LEFT JOIN kd_asset asset ON xa.asset_id = asset.id
         LEFT JOIN kd_asset asset ON xa.asset_id = asset.id
         LEFT JOIN
         LEFT JOIN

+ 4 - 2
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/XmIntangibleAssetMapper.xml

@@ -7,6 +7,8 @@
         <result column="tenant_id" property="tenantId"/>
         <result column="tenant_id" property="tenantId"/>
         <result column="year_and_month" property="yearAndMonth"/>
         <result column="year_and_month" property="yearAndMonth"/>
         <result column="xm_id" property="xmId"/>
         <result column="xm_id" property="xmId"/>
+        <result column="xmbh" property="xmbh"/>
+        <result column="xmmc" property="xmmc"/>
         <result column="asset_id" property="assetId"/>
         <result column="asset_id" property="assetId"/>
         <result column="zcbm" property="zcbm"/>
         <result column="zcbm" property="zcbm"/>
         <result column="user_unicode" property="userUnicode"/>
         <result column="user_unicode" property="userUnicode"/>
@@ -65,10 +67,10 @@
     </select>
     </select>
 
 
     <select id="selectPageByYear" resultMap="ResultMap">
     <select id="selectPageByYear" resultMap="ResultMap">
-        SELECT xa.xm_id, xa.asset_id, t.name as user_name,<include refid="org.sky.scientific.mapper.AssetMapper.basicColumns"/>
+        SELECT xa.xm_id, xm.XMMC as xmmc, xm.XMBH as xmbh, xa.asset_id,xa.zcbm, t.name as user_name,<include refid="org.sky.scientific.mapper.AssetMapper.basicColumns"/>
         FROM kd_xm_intangible_asset xa
         FROM kd_xm_intangible_asset xa
         LEFT JOIN kd_asset asset ON xa.asset_id = asset.id
         LEFT JOIN kd_asset asset ON xa.asset_id = asset.id
-        LEFT JOIN kd_technician t on t.unicode=xa.user_unicode and t.year_and_month = #{ew.yearAndMonth}
+        LEFT JOIN kd_technician t on t.unicode=xa.user_unicode and t.year_and_month = xa.year_and_month
         LEFT JOIN
         LEFT JOIN
         (
         (
             SELECT
             SELECT

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

@@ -76,6 +76,7 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 	private final XmMapper xmMapper;
 	private final XmMapper xmMapper;
 	private final ISysClient sysClient;
 	private final ISysClient sysClient;
 	private final FreeMarkerConfigurer freeMarkerConfigurer;
 	private final FreeMarkerConfigurer freeMarkerConfigurer;
+	private final XmFixedAssetMapper xmFixedAssetMapper;
 
 
 	@Override
 	@Override
 	@Transactional
 	@Transactional
@@ -236,7 +237,6 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 			throw new ServiceException("参数year为年份,如2025");
 			throw new ServiceException("参数year为年份,如2025");
 		}
 		}
 
 
-
 		A107_2VO vo = 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()));
 		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)) {
 		if (Func.notNull(db)) {
@@ -339,10 +339,32 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 		BigDecimal d18 = wwxmCostVOList.stream().filter(item -> Func.equals(item.getStflx(), "境外机构")).map(XmWwxmCostVO::getPayAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
 		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));
 		vo.setD18(d18.multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
 
 
-		// todo 三、研究开发资产情况
+		// 三、研究开发资产情况
 		// d20 当年形成用于研发开发的固定资产
 		// d20 当年形成用于研发开发的固定资产
+		XmAssetQueryParam p = new XmAssetQueryParam();
+		p.setYearAndMonth(year);
+		List<XmFixedAsset> yiqishebeiList = xmFixedAssetMapper.selectXmFixedAssetPageByYear(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), p, "仪器设备");
+		List<XmFixedAsset> fangwujianzhuwuList = xmFixedAssetMapper.selectXmFixedAssetPageByYear(Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE)), p, "房屋建筑物");
+
+		BigDecimal yiqishebeiTotal = BigDecimal.ZERO;
+		for (XmFixedAsset yiqishebei : yiqishebeiList) {
+			AssetEntity asset = yiqishebei.getAsset();
+			if(Func.equals(DateUtil.format(asset.getKssj(), DateUtil.PATTERN_YYYY),  year)){
+				yiqishebeiTotal = yiqishebeiTotal.add(asset.getZcyz());
+			}
+		}
+
+		BigDecimal fangwujianzhuwuTotal = BigDecimal.ZERO;
+		for (XmFixedAsset fangwujianzhuwu : fangwujianzhuwuList) {
+			AssetEntity asset = fangwujianzhuwu.getAsset();
+			if(Func.equals(DateUtil.format(asset.getKssj(), DateUtil.PATTERN_YYYY),  year)){
+				yiqishebeiTotal = fangwujianzhuwuTotal.add(asset.getZcyz());
+			}
+		}
 
 
+		vo.setD20(fangwujianzhuwuTotal.add(yiqishebeiTotal).multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
 		// d21 其中:仪器和设备
 		// d21 其中:仪器和设备
+		vo.setD21(yiqishebeiTotal.multiply(new BigDecimal("0.001")).setScale(2, RoundingMode.HALF_UP));
 
 
 		//四、研究开发支出资金来源
 		//四、研究开发支出资金来源
 		//2.来自政府部门
 		//2.来自政府部门
@@ -352,16 +374,18 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 		}
 		}
 		vo.setD43(vo.getD43().setScale(2, RoundingMode.HALF_UP));
 		vo.setD43(vo.getD43().setScale(2, RoundingMode.HALF_UP));
 
 
-		//五、相关政策落实情况
+		//todo 五、相关政策落实情况
 		//申报加计扣除减免税的研究开发支出
 		//申报加计扣除减免税的研究开发支出
+//		vo.setD52();
 		//加计扣除减免税金额
 		//加计扣除减免税金额
+//		vo.setD44();
 
 
 		//六、企业办研究开发机构 (境内)情况
 		//六、企业办研究开发机构 (境内)情况
 		// d27 :期末仪器和设备原价
 		// d27 :期末仪器和设备原价
 		IPage<XmFixedAsset> p2 = Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE));
 		IPage<XmFixedAsset> p2 = Condition.getPage(new Query().setCurrent(1).setSize(Integer.MAX_VALUE));
 		XmAssetQueryParam param = new XmAssetQueryParam();
 		XmAssetQueryParam param = new XmAssetQueryParam();
 		param.setYearAndMonth(year + "12");
 		param.setYearAndMonth(year + "12");
-		List<XmFixedAsset> yiqishebeiList = fixedAssetMapper.selectXmFixedAssetPageByYearAndMonth(p2, param, "仪器设备");
+		yiqishebeiList = fixedAssetMapper.selectXmFixedAssetPageByYearAndMonth(p2, param, "仪器设备");
 		for (XmFixedAsset asset : yiqishebeiList) {
 		for (XmFixedAsset asset : yiqishebeiList) {
 			vo.setD27(vo.getD7().add(asset.getAsset().getZcyz()));
 			vo.setD27(vo.getD7().add(asset.getAsset().getZcyz()));
 		}
 		}

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

@@ -431,8 +431,7 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
 
 
 	@Override
 	@Override
 	public IPage<TechnicianVO> niandugaokejirenyuanhuizongbiao(IPage<TechnicianVO> page, TechnicianDTO dto) {
 	public IPage<TechnicianVO> niandugaokejirenyuanhuizongbiao(IPage<TechnicianVO> page, TechnicianDTO dto) {
-		//TODO 目前因测试数据不多,需求是 年度天数大于183的才显示,这里先用18代替,后期要改回来
-		dto.setTenantId(SecureUtil.getTenantId());
+ 		dto.setTenantId(SecureUtil.getTenantId());
 		List<TechnicianVO> list = baseMapper.niandugaokejirenyuanhuizongbiao(page, dto);
 		List<TechnicianVO> list = baseMapper.niandugaokejirenyuanhuizongbiao(page, dto);
 		for (TechnicianVO vo : list) {
 		for (TechnicianVO vo : list) {
 			vo.setGenderName(DictCache.getValue(DictEnum.SEX, vo.getGender()));
 			vo.setGenderName(DictCache.getValue(DictEnum.SEX, vo.getGender()));

+ 14 - 9
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/XmOtherCostServiceImpl.java

@@ -8,6 +8,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
 import com.alibaba.excel.write.metadata.fill.FillConfig;
 import com.alibaba.excel.write.metadata.fill.FillConfig;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import lombok.SneakyThrows;
@@ -22,6 +23,7 @@ import org.sky.scientific.mapper.SubjectMapper;
 import org.sky.scientific.mapper.XmMapper;
 import org.sky.scientific.mapper.XmMapper;
 import org.sky.scientific.mapper.XmOtherCostMapper;
 import org.sky.scientific.mapper.XmOtherCostMapper;
 import org.sky.scientific.pojo.dto.XmOtherCostQuery;
 import org.sky.scientific.pojo.dto.XmOtherCostQuery;
+import org.sky.scientific.pojo.entity.Subject;
 import org.sky.scientific.pojo.entity.XmOtherCostEntity;
 import org.sky.scientific.pojo.entity.XmOtherCostEntity;
 import org.sky.scientific.service.IXmOtherCostService;
 import org.sky.scientific.service.IXmOtherCostService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -65,7 +67,7 @@ public class XmOtherCostServiceImpl extends BaseServiceImpl<XmOtherCostMapper, X
 			throw new ServiceException("参数yearAndMonth不能为空");
 			throw new ServiceException("参数yearAndMonth不能为空");
 		}
 		}
 
 
-		List<XmOtherCostExcel> dataList = ExcelUtil.read(file, XmOtherCostExcel.class);
+		List<XmOtherCostExcel> dataList = ExcelUtil.read(file, 0, 2, XmOtherCostExcel.class);
 		if (CollectionUtil.isEmpty(dataList)) {
 		if (CollectionUtil.isEmpty(dataList)) {
 			throw new ServiceException("导入数据为空");
 			throw new ServiceException("导入数据为空");
 		}
 		}
@@ -74,14 +76,6 @@ public class XmOtherCostServiceImpl extends BaseServiceImpl<XmOtherCostMapper, X
 		for (XmOtherCostExcel data : dataList) {
 		for (XmOtherCostExcel data : dataList) {
 			XmOtherCostEntity entity = Objects.requireNonNull(BeanUtil.copyProperties(data, XmOtherCostEntity.class));
 			XmOtherCostEntity entity = Objects.requireNonNull(BeanUtil.copyProperties(data, XmOtherCostEntity.class));
 
 
-			//TODO 根据四级科目查询科目id,且三级科目必须要其他费用,如果不存在则报错
-			Long subjectId = null;
-//			subjectMapper.select
-//				xmMapper.getSubjectIdBySubjectName(data.getSubjectName());
-//			if (Func.isNull(subjectId)) {
-//				throw new ServiceException("序号[" + data.getXh() + "]的费用内容[" + data.getSubjectName() + "]不是其他费用的四级科目");
-//			}
-
 			if (!Func.equals(yearAndMonth, DateUtil.format(data.getRecordDate(), DateUtil.PATTERN_YYYYMM))) {
 			if (!Func.equals(yearAndMonth, DateUtil.format(data.getRecordDate(), DateUtil.PATTERN_YYYYMM))) {
 				throw new ServiceException("序号[" + data.getXh() + "]的日期[" + data.getRecordDate() + "]不属于[" + yearAndMonth + "]");
 				throw new ServiceException("序号[" + data.getXh() + "]的日期[" + data.getRecordDate() + "]不属于[" + yearAndMonth + "]");
 			}
 			}
@@ -89,6 +83,17 @@ public class XmOtherCostServiceImpl extends BaseServiceImpl<XmOtherCostMapper, X
 			if (StringUtil.isAllBlank(data.getXmmc(), data.getXmbh())) {
 			if (StringUtil.isAllBlank(data.getXmmc(), data.getXmbh())) {
 				throw new ServiceException("序号[" + data.getXh() + "]的研发项目编号和名称都为空,请重新填写数据");
 				throw new ServiceException("序号[" + data.getXh() + "]的研发项目编号和名称都为空,请重新填写数据");
 			}
 			}
+
+			//根据四级科目查询科目id,且三级科目必须要其他费用,如果不存在则报错
+			List<Subject> subjectList = subjectMapper.selectList(Wrappers.<Subject>lambdaQuery().eq(Subject::getAccSubject, data.getSubjectName()));
+			if(Func.isEmpty(subjectList)){
+				throw new ServiceException("序号[" + data.getXh() + "]的费用内容[" + data.getSubjectName() + "]没有匹配到会计科目");
+			}
+			if(subjectList.size() > 1){
+				throw new ServiceException("序号[" + data.getXh() + "]的费用内容[" + data.getSubjectName() + "]匹配到了多个会计科目");
+			}
+			Long subjectId = subjectList.get(0).getId();
+
 			//根据项目名称或编号查询xmId
 			//根据项目名称或编号查询xmId
 			Long xmId = xmMapper.getXmIdByXmmcOrXmbh(yearAndMonth, data.getXmmc(), data.getXmbh());
 			Long xmId = xmMapper.getXmIdByXmmcOrXmbh(yearAndMonth, data.getXmmc(), data.getXmbh());
 			if (xmId == null) {
 			if (xmId == null) {

BIN
kd-service/kd-scientific/src/main/resources/export-template/研发费用管理-其他费用.xls