zhoulisky 9 months ago
parent
commit
00c48d4ace
28 changed files with 383 additions and 274 deletions
  1. 4 6
      kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/entity/YsWxzctxfyEntity.java
  2. 1 1
      kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/vo/YsWxzctxfyVO.java
  3. 0 1
      kd-service/kd-scientific/src/main/java/org/sky/scientific/controller/YsQtfyController.java
  4. 1 1
      kd-service/kd-scientific/src/main/java/org/sky/scientific/controller/YsWxzctxfyController.java
  5. 8 42
      kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsQtfyExcel.java
  6. 6 15
      kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsSjfyExcel.java
  7. 10 47
      kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsWtwbyjkffyExcel.java
  8. 9 55
      kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsWxzctxfyExcel.java
  9. 8 43
      kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsZbtsysyfyExcel.java
  10. 2 4
      kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/YsWxzctxfyMapper.xml
  11. 8 0
      kd-service/kd-scientific/src/main/java/org/sky/scientific/service/IYsWxzctxfyService.java
  12. 45 7
      kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsQtfyServiceImpl.java
  13. 46 5
      kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsSjfyServiceImpl.java
  14. 35 5
      kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsWtwbyjkffyServiceImpl.java
  15. 105 10
      kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsWxzctxfyServiceImpl.java
  16. 40 5
      kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsZbtsysyfyServiceImpl.java
  17. 4 0
      kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsZjfyycqdtfyServiceImpl.java
  18. 1 1
      kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsZjtrfyServiceImpl.java
  19. 0 6
      kd-service/kd-system/src/main/java/org/sky/system/controller/DictBizController.java
  20. 7 0
      kd-service/kd-system/src/main/java/org/sky/system/controller/DictController.java
  21. 0 3
      kd-service/kd-system/src/main/java/org/sky/system/mapper/DictBizMapper.java
  22. 26 12
      kd-service/kd-system/src/main/java/org/sky/system/mapper/DictBizMapper.xml
  23. 3 0
      kd-service/kd-system/src/main/java/org/sky/system/mapper/DictMapper.java
  24. 8 0
      kd-service/kd-system/src/main/java/org/sky/system/mapper/DictMapper.xml
  25. 0 1
      kd-service/kd-system/src/main/java/org/sky/system/service/IDictBizService.java
  26. 1 0
      kd-service/kd-system/src/main/java/org/sky/system/service/IDictService.java
  27. 0 4
      kd-service/kd-system/src/main/java/org/sky/system/service/impl/DictBizServiceImpl.java
  28. 5 0
      kd-service/kd-system/src/main/java/org/sky/system/service/impl/DictServiceImpl.java

+ 4 - 6
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/entity/YsWxzctxfyEntity.java

@@ -29,6 +29,10 @@ public class YsWxzctxfyEntity extends TenantEntity {
 	@NotNull(message = "请选择研发项目")
 	private Long xmId;
 
+	@Schema(description = "资产id")
+	@NotNull(message = "请选择资产")
+	private Long assetId;
+
 	@Schema(description = "资产编码")
 	@NotBlank(message = "请选择资产")
 	private String zcbm;
@@ -36,10 +40,4 @@ public class YsWxzctxfyEntity extends TenantEntity {
 	@Schema(description = "在项目中的工作时长(月)")
 	private Integer zzsc;
 
-	@Schema(description = "长期待摊费用名称")
-	private String cqdtfymc;
-
-	@Schema(description = "长期待摊费用预算金额")
-	private Double cqdtfyysje;
-
 }

+ 1 - 1
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/vo/YsWxzctxfyVO.java

@@ -21,6 +21,6 @@ public class YsWxzctxfyVO extends YsWxzctxfyEntity {
 	@Serial
 	private static final long serialVersionUID = 1L;
 
-	@Schema(description = "资产信息")
+	@Schema(description = "资产信息", hidden = true)
 	private AssetEntity zcEntity;
 }

+ 0 - 1
kd-service/kd-scientific/src/main/java/org/sky/scientific/controller/YsQtfyController.java

@@ -79,7 +79,6 @@ public class YsQtfyController extends KdController {
 	@ApiOperationSupport(order = 8)
 	@Operation(summary = "导入", description = "传入excel")
 	public R importQtfy(MultipartFile file, Long xmId) {
-
 		service.importQtfy(file, xmId);
 		return R.success("操作成功");
 	}

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

@@ -54,7 +54,7 @@ public class YsWxzctxfyController extends KdController {
 	@ApiOperationSupport(order = 4)
 	@Operation(summary = "新增", description  = "传入ysWxzctxfy")
 	public R save(@Valid @RequestBody YsWxzctxfyEntity ysWxzctxfy) {
-		return R.status(service.save(ysWxzctxfy));
+		return R.status(service.saveWxzctxfy(ysWxzctxfy));
 	}
 
 	@PostMapping("/update")

+ 8 - 42
kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsQtfyExcel.java

@@ -2,14 +2,11 @@
 package org.sky.scientific.excel;
 
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
-import com.alibaba.excel.annotation.ExcelProperty;
-import com.alibaba.excel.annotation.write.style.ColumnWidth;
-import com.alibaba.excel.annotation.write.style.ContentRowHeight;
-import com.alibaba.excel.annotation.write.style.HeadRowHeight;
-import java.io.Serializable;
 import java.io.Serial;
+import java.io.Serializable;
 
 
 /**
@@ -19,49 +16,18 @@ import java.io.Serial;
  * @since 2025-06-29
  */
 @Data
-@ColumnWidth(25)
-@HeadRowHeight(20)
-@ContentRowHeight(18)
 public class YsQtfyExcel implements Serializable {
 
 	@Serial
 	private static final long serialVersionUID = 1L;
 
-	/**
-	 * 主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("主键")
-	private Long id;
-	/**
-	 * 租户ID
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("租户ID")
-	private String tenantId;
-	/**
-	 * 科研项目id,kd_xm的主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("科研项目id,kd_xm的主键")
-	private Long xmId;
-	/**
-	 * 费用内容
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("费用内容")
+	@ExcelProperty(index = 0, value = "序号")
+	private Integer xh;
+
+	@ExcelProperty(index = 1, value = "费用内容")
 	private String fynr;
-	/**
-	 * 预算金额
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("预算金额")
+
+	@ExcelProperty(index = 4, value = "预算金额/万元")
 	private Double ysje;
-	/**
-	 * 是否已删除
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("是否已删除")
-	private Integer isDeleted;
 
 }

+ 6 - 15
kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsSjfyExcel.java

@@ -2,14 +2,11 @@
 package org.sky.scientific.excel;
 
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
-import com.alibaba.excel.annotation.ExcelProperty;
-import com.alibaba.excel.annotation.write.style.ColumnWidth;
-import com.alibaba.excel.annotation.write.style.ContentRowHeight;
-import com.alibaba.excel.annotation.write.style.HeadRowHeight;
-import java.io.Serializable;
 import java.io.Serial;
+import java.io.Serializable;
 
 
 /**
@@ -19,24 +16,18 @@ import java.io.Serial;
  * @since 2025-06-29
  */
 @Data
-@ColumnWidth(25)
-@HeadRowHeight(20)
-@ContentRowHeight(18)
 public class YsSjfyExcel implements Serializable {
 
 	@Serial
 	private static final long serialVersionUID = 1L;
 
-	@ColumnWidth(20)
-	@ExcelProperty("科研项目id,kd_xm的主键")
-	private Long xmId;
+ 	@ExcelProperty(index = 0,value = "序号")
+	private Long xh;
 
-	@ColumnWidth(20)
-	@ExcelProperty("设计内容或详情")
+	@ExcelProperty(index = 1, value = "设计内容或详情")
 	private String sjnr;
 
-	@ColumnWidth(20)
-	@ExcelProperty("预算金额")
+	@ExcelProperty(index = 3, value = "预算金额/万元")
 	private Double ysje;
 
 }

+ 10 - 47
kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsWtwbyjkffyExcel.java

@@ -2,14 +2,11 @@
 package org.sky.scientific.excel;
 
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
-import com.alibaba.excel.annotation.ExcelProperty;
-import com.alibaba.excel.annotation.write.style.ColumnWidth;
-import com.alibaba.excel.annotation.write.style.ContentRowHeight;
-import com.alibaba.excel.annotation.write.style.HeadRowHeight;
-import java.io.Serializable;
 import java.io.Serial;
+import java.io.Serializable;
 
 
 /**
@@ -19,55 +16,21 @@ import java.io.Serial;
  * @since 2025-06-29
  */
 @Data
-@ColumnWidth(25)
-@HeadRowHeight(20)
-@ContentRowHeight(18)
 public class YsWtwbyjkffyExcel implements Serializable {
 
 	@Serial
 	private static final long serialVersionUID = 1L;
 
-	/**
-	 * 主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("主键")
-	private Long id;
-	/**
-	 * 租户ID
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("租户ID")
-	private String tenantId;
-	/**
-	 * 科研项目id,kd_xm的主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("科研项目id,kd_xm的主键")
-	private Long xmId;
-	/**
-	 * 受托单位名称
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("受托单位名称")
+	@ExcelProperty(index = 0,value = "序号")
+	private Integer xh;
+
+ 	@ExcelProperty(index = 1, value = "受托单位名称")
 	private String stdwmc;
-	/**
-	 * 工作内容
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("工作内容")
+
+ 	@ExcelProperty(index = 3, value = "工作内容")
 	private String zznr;
-	/**
-	 * 委外费用/元
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("委外费用/元")
+
+ 	@ExcelProperty(index = 4, value ="委外费用/万元")
 	private Double wwfy;
-	/**
-	 * 是否已删除
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("是否已删除")
-	private Integer isDeleted;
 
 }

+ 9 - 55
kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsWxzctxfyExcel.java

@@ -2,14 +2,11 @@
 package org.sky.scientific.excel;
 
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
-import com.alibaba.excel.annotation.ExcelProperty;
-import com.alibaba.excel.annotation.write.style.ColumnWidth;
-import com.alibaba.excel.annotation.write.style.ContentRowHeight;
-import com.alibaba.excel.annotation.write.style.HeadRowHeight;
-import java.io.Serializable;
 import java.io.Serial;
+import java.io.Serializable;
 
 
 /**
@@ -19,61 +16,18 @@ import java.io.Serial;
  * @since 2025-06-29
  */
 @Data
-@ColumnWidth(25)
-@HeadRowHeight(20)
-@ContentRowHeight(18)
 public class YsWxzctxfyExcel implements Serializable {
 
 	@Serial
 	private static final long serialVersionUID = 1L;
 
-	/**
-	 * 主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("主键")
-	private Long id;
-	/**
-	 * 租户ID
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("租户ID")
-	private String tenantId;
-	/**
-	 * 科研项目id,kd_xm的主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("科研项目id,kd_xm的主键")
-	private Long xmId;
-	/**
-	 * 资产id,kd_zichan的主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("资产id,kd_zichan的主键")
-	private Long zcId;
-	/**
-	 * 在项目中的工作时长(月)
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("在项目中的工作时长(月)")
+	@ExcelProperty(index = 0, value = "序号")
+	private Integer xh;
+
+	@ExcelProperty(index = 1, value = "资产名称")
+	private String zcmc;
+
+	@ExcelProperty(index = 2, value = "在项目中的工作时长(月)")
 	private Integer zzsc;
-	/**
-	 * 是否已删除
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("是否已删除")
-	private Integer isDeleted;
-	/**
-	 * 长期待摊费用名称
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("长期待摊费用名称")
-	private Double cqdtfymc;
-	/**
-	 * 长期待摊费用预算金额
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("长期待摊费用预算金额")
-	private Double cqdtfyysje;
 
 }

+ 8 - 43
kd-service/kd-scientific/src/main/java/org/sky/scientific/excel/YsZbtsysyfyExcel.java

@@ -2,14 +2,11 @@
 package org.sky.scientific.excel;
 
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
-import com.alibaba.excel.annotation.ExcelProperty;
-import com.alibaba.excel.annotation.write.style.ColumnWidth;
-import com.alibaba.excel.annotation.write.style.ContentRowHeight;
-import com.alibaba.excel.annotation.write.style.HeadRowHeight;
-import java.io.Serializable;
 import java.io.Serial;
+import java.io.Serializable;
 
 
 /**
@@ -19,49 +16,17 @@ import java.io.Serial;
  * @since 2025-06-29
  */
 @Data
-@ColumnWidth(25)
-@HeadRowHeight(20)
-@ContentRowHeight(18)
 public class YsZbtsysyfyExcel implements Serializable {
 
 	@Serial
 	private static final long serialVersionUID = 1L;
 
-	/**
-	 * 主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("主键")
-	private Long id;
-	/**
-	 * 租户ID
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("租户ID")
-	private String tenantId;
-	/**
-	 * 科研项目id,kd_xm的主键
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("科研项目id,kd_xm的主键")
-	private Long xmId;
-	/**
-	 * 费用内容
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("费用内容")
+	@ExcelProperty(index = 0, value = "序号")
+	private Integer xh;
+
+	@ExcelProperty(index = 1, value = "费用内容")
 	private String fyje;
-	/**
-	 * 预算金额
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("预算金额")
-	private Double ysje;
-	/**
-	 * 是否已删除
-	 */
-	@ColumnWidth(20)
-	@ExcelProperty("是否已删除")
-	private Integer isDeleted;
 
+ 	@ExcelProperty(index = 3, value = "预算金额/万元")
+	private Double ysje;
 }

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

@@ -7,10 +7,9 @@
         <result column="id" property="id"/>
         <result column="tenant_id" property="tenantId"/>
         <result column="XM_ID" property="xmId"/>
+        <result column="asset_id" property="assetId"/>
         <result column="ZCBM" property="zcbm"/>
         <result column="ZZSC" property="zzsc"/>
-        <result column="CQDTFYMC" property="cqdtfymc"/>
-        <result column="CQDTFYYSJE" property="cqdtfyysje"/>
         <result column="create_user" property="createUser"/>
         <result column="create_dept" property="createDept"/>
         <result column="create_time" property="createTime"/>
@@ -21,7 +20,7 @@
     </resultMap>
 
     <resultMap id="ResultVoMap" type="org.sky.scientific.pojo.vo.YsWxzctxfyVO" extends="ResultMap">
-        <association property="zcEntity" column="ZCBM" select="org.sky.scientific.mapper.AssetMapper.selectLastOneByZcbm"/>
+        <association property="zcEntity" column="asset_id" select="org.sky.scientific.mapper.AssetMapper.selectById"/>
     </resultMap>
 
     <delete id="physicalDeleteByIds">
@@ -30,7 +29,6 @@
         <foreach item="id" collection="list" separator="," close=")" open="(" index="">
             #{id}
         </foreach>
-        />
     </delete>
 
 

+ 8 - 0
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/IYsWxzctxfyService.java

@@ -58,4 +58,12 @@ public interface IYsWxzctxfyService extends BaseService<YsWxzctxfyEntity> {
 	 * @param xmId
 	 */
     void importWxzctxfy(MultipartFile file, Long xmId);
+
+	/**
+	 * 新增
+	 *
+	 * @param ysWxzctxfy 实体
+	 * @return boolean
+	 */
+	boolean saveWxzctxfy(YsWxzctxfyEntity ysWxzctxfy);
 }

+ 45 - 7
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsQtfyServiceImpl.java

@@ -1,20 +1,24 @@
 
 package org.sky.scientific.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.AllArgsConstructor;
 import org.sky.core.excel.util.ExcelUtil;
 import org.sky.core.log.exception.ServiceException;
-import org.sky.scientific.excel.YsRyrgfyExcel;
-import org.sky.scientific.pojo.entity.YsQtfyEntity;
-import org.sky.scientific.pojo.vo.YsQtfyVO;
+import org.sky.core.mp.base.BaseServiceImpl;
+import org.sky.core.tool.utils.Func;
 import org.sky.scientific.excel.YsQtfyExcel;
+import org.sky.scientific.mapper.XmMapper;
 import org.sky.scientific.mapper.YsQtfyMapper;
+import org.sky.scientific.pojo.entity.YsQtfyEntity;
+import org.sky.scientific.pojo.vo.XmVO;
+import org.sky.scientific.pojo.vo.YsQtfyVO;
 import org.sky.scientific.service.IYsQtfyService;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.sky.core.mp.base.BaseServiceImpl;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -24,8 +28,11 @@ import java.util.List;
  * @since 2025-06-29
  */
 @Service
+@AllArgsConstructor
 public class YsQtfyServiceImpl extends BaseServiceImpl<YsQtfyMapper, YsQtfyEntity> implements IYsQtfyService {
 
+	private final XmMapper xmMapper;
+
 	@Override
 	public IPage<YsQtfyVO> selectYsQtfyPage(IPage<YsQtfyVO> page, YsQtfyVO ysQtfy) {
 		return page.setRecords(baseMapper.selectYsQtfyPage(page, ysQtfy));
@@ -56,7 +63,38 @@ public class YsQtfyServiceImpl extends BaseServiceImpl<YsQtfyMapper, YsQtfyEntit
 
     @Override
     public void importQtfy(MultipartFile file, Long xmId) {
-		List<YsRyrgfyExcel> dataList = ExcelUtil.read(file, 2, 4, YsRyrgfyExcel.class);
+		if (Func.isNull(xmId)) {
+			throw new ServiceException("请选择研发项目");
+		}
+		XmVO xmVO = xmMapper.selectByXmId(xmId);
+		if (Func.isNull(xmVO)) {
+			throw new ServiceException("研发项目不存在");
+		}
+
+
+		List<YsQtfyExcel> dataList = ExcelUtil.read(file, 8, 3, YsQtfyExcel.class);
+		if (Func.isEmpty(dataList)) {
+			throw new ServiceException("读取导入数据失败,请检查数据");
+		}
+
+		List<YsQtfyEntity> insertList = new ArrayList<>();
+		int batchCount = 20;
+		for (YsQtfyExcel excel : dataList) {
+
+			YsQtfyEntity entity = new YsQtfyEntity();
+			entity.setXmId(xmId);
+			entity.setFynr(excel.getFynr());
+ 			entity.setYsje(excel.getYsje());
+ 			insertList.add(entity);
+
+			if (insertList.size() % batchCount == 0 && this.saveBatch(insertList)) {
+				insertList.clear();
+			}
+		}
+
+		if (Func.isNotEmpty(insertList)) {
+			this.saveBatch(insertList);
+		}
     }
 
 }

+ 46 - 5
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsSjfyServiceImpl.java

@@ -1,18 +1,24 @@
 
 package org.sky.scientific.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.AllArgsConstructor;
+import org.sky.core.excel.util.ExcelUtil;
 import org.sky.core.log.exception.ServiceException;
-import org.sky.scientific.pojo.entity.YsSjfyEntity;
-import org.sky.scientific.pojo.vo.YsSjfyVO;
+import org.sky.core.mp.base.BaseServiceImpl;
+import org.sky.core.tool.utils.Func;
 import org.sky.scientific.excel.YsSjfyExcel;
+import org.sky.scientific.mapper.XmMapper;
 import org.sky.scientific.mapper.YsSjfyMapper;
+import org.sky.scientific.pojo.entity.YsSjfyEntity;
+import org.sky.scientific.pojo.vo.XmVO;
+import org.sky.scientific.pojo.vo.YsSjfyVO;
 import org.sky.scientific.service.IYsSjfyService;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.sky.core.mp.base.BaseServiceImpl;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -22,8 +28,11 @@ import java.util.List;
  * @since 2025-06-29
  */
 @Service
+@AllArgsConstructor
 public class YsSjfyServiceImpl extends BaseServiceImpl<YsSjfyMapper, YsSjfyEntity> implements IYsSjfyService {
 
+	private final XmMapper xmMapper;
+
 	@Override
 	public IPage<YsSjfyVO> selectYsSjfyPage(IPage<YsSjfyVO> page, YsSjfyVO ysSjfy) {
 		return page.setRecords(baseMapper.selectYsSjfyPage(page, ysSjfy));
@@ -53,7 +62,39 @@ public class YsSjfyServiceImpl extends BaseServiceImpl<YsSjfyMapper, YsSjfyEntit
 
 	@Override
 	public void importSjfy(MultipartFile file, Long xmId) {
+		if (Func.isNull(xmId)) {
+			throw new ServiceException("请选择研发项目");
+		}
+		XmVO xmVO = xmMapper.selectByXmId(xmId);
+		if (Func.isNull(xmVO)) {
+			throw new ServiceException("研发项目不存在");
+		}
+
+
+		List<YsSjfyExcel> dataList = ExcelUtil.read(file, 5, 3, YsSjfyExcel.class);
+		if (Func.isEmpty(dataList)) {
+			throw new ServiceException("读取导入数据失败,请检查数据");
+		}
+
+		List<YsSjfyEntity> insertList = new ArrayList<>();
+		int batchCount = 20;
+		for (YsSjfyExcel excel : dataList) {
 
+			YsSjfyEntity entity = new YsSjfyEntity();
+			entity.setXmId(xmId);
+			entity.setSjnr(excel.getSjnr());
+			entity.setYsje(excel.getYsje());
+
+			insertList.add(entity);
+
+			if (insertList.size() % batchCount == 0 && this.saveBatch(insertList)) {
+				insertList.clear();
+			}
+		}
+
+		if (Func.isNotEmpty(insertList)) {
+			this.saveBatch(insertList);
+		}
 	}
 
 }

+ 35 - 5
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsWtwbyjkffyServiceImpl.java

@@ -1,18 +1,22 @@
 
 package org.sky.scientific.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.sky.core.excel.util.ExcelUtil;
 import org.sky.core.log.exception.ServiceException;
-import org.sky.scientific.pojo.entity.YsWtwbyjkffyEntity;
-import org.sky.scientific.pojo.vo.YsWtwbyjkffyVO;
+import org.sky.core.mp.base.BaseServiceImpl;
+import org.sky.core.tool.utils.BeanUtil;
+import org.sky.core.tool.utils.Func;
 import org.sky.scientific.excel.YsWtwbyjkffyExcel;
 import org.sky.scientific.mapper.YsWtwbyjkffyMapper;
+import org.sky.scientific.pojo.entity.YsWtwbyjkffyEntity;
+import org.sky.scientific.pojo.vo.YsWtwbyjkffyVO;
 import org.sky.scientific.service.IYsWtwbyjkffyService;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.sky.core.mp.base.BaseServiceImpl;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -54,7 +58,33 @@ public class YsWtwbyjkffyServiceImpl extends BaseServiceImpl<YsWtwbyjkffyMapper,
 
 	@Override
 	public void importWtwbyjkffy(MultipartFile file, Long xmId) {
+		if (Func.isNull(xmId)) {
+			throw new ServiceException("请选择研发项目");
+		}
+
+		List<YsWtwbyjkffyExcel> dataList = ExcelUtil.read(file, 7, 3, YsWtwbyjkffyExcel.class);
+		if(Func.isEmpty(dataList)){
+			throw new ServiceException("读取导入数据失败,请检查数据");
+		}
+
+		List<YsWtwbyjkffyEntity> insertList = new ArrayList<>();
+		int batchCount = 20;
+		for (YsWtwbyjkffyExcel excel : dataList) {
+
+			YsWtwbyjkffyEntity entity = new YsWtwbyjkffyEntity();
+			entity.setXmId(xmId);
 
+			BeanUtil.copyProperties(excel, entity);
+ 			insertList.add(entity);
+
+			if (insertList.size() % batchCount == 0 && this.saveBatch(insertList)) {
+				insertList.clear();
+			}
+		}
+
+		if (Func.isNotEmpty(insertList)) {
+			this.saveBatch(insertList);
+		}
 	}
 
 }

+ 105 - 10
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsWxzctxfyServiceImpl.java

@@ -1,18 +1,30 @@
 
 package org.sky.scientific.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+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.excel.util.ExcelUtil;
 import org.sky.core.log.exception.ServiceException;
-import org.sky.scientific.pojo.entity.YsWxzctxfyEntity;
-import org.sky.scientific.pojo.vo.YsWxzctxfyVO;
+import org.sky.core.mp.base.BaseServiceImpl;
+import org.sky.core.tool.utils.BeanUtil;
+import org.sky.core.tool.utils.DateUtil;
+import org.sky.core.tool.utils.Func;
 import org.sky.scientific.excel.YsWxzctxfyExcel;
+import org.sky.scientific.mapper.AssetMapper;
+import org.sky.scientific.mapper.XmMapper;
 import org.sky.scientific.mapper.YsWxzctxfyMapper;
+import org.sky.scientific.pojo.entity.AssetEntity;
+import org.sky.scientific.pojo.entity.YsWxzctxfyEntity;
+import org.sky.scientific.pojo.vo.XmVO;
+import org.sky.scientific.pojo.vo.YsWxzctxfyVO;
 import org.sky.scientific.service.IYsWxzctxfyService;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.sky.core.mp.base.BaseServiceImpl;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -22,8 +34,12 @@ import java.util.List;
  * @since 2025-06-29
  */
 @Service
+@AllArgsConstructor
 public class YsWxzctxfyServiceImpl extends BaseServiceImpl<YsWxzctxfyMapper, YsWxzctxfyEntity> implements IYsWxzctxfyService {
 
+	private final AssetMapper assetMapper;
+	private final XmMapper xmMapper;
+
 	@Override
 	public IPage<YsWxzctxfyVO> selectYsWxzctxfyPage(IPage<YsWxzctxfyVO> page, YsWxzctxfyVO ysWxzctxfy) {
 		return page.setRecords(baseMapper.selectYsWxzctxfyPage(page, ysWxzctxfy));
@@ -39,22 +55,101 @@ public class YsWxzctxfyServiceImpl extends BaseServiceImpl<YsWxzctxfyMapper, YsW
 		return ysWxzctxfyList;
 	}
 
-    @Override
-    public boolean physicalDeleteByIds(List<Long> ids) {
-        return baseMapper.physicalDeleteByIds(ids) > 0;
-    }
+	@Override
+	public boolean physicalDeleteByIds(List<Long> ids) {
+		return baseMapper.physicalDeleteByIds(ids) > 0;
+	}
 
 	@Override
 	public boolean updateWxzctxfy(YsWxzctxfyEntity ysWxzctxfy) {
-		if(ysWxzctxfy.getXmId() == null){
+		if (ysWxzctxfy.getId() == null) {
+			throw new ServiceException("id不能为空");
+		}
+		if (ysWxzctxfy.getXmId() == null) {
 			throw new ServiceException("请选择科研项目");
 		}
+		LambdaQueryWrapper<YsWxzctxfyEntity> wrapper = Wrappers.<YsWxzctxfyEntity>lambdaQuery()
+			.eq(YsWxzctxfyEntity::getXmId, ysWxzctxfy.getXmId())
+			.eq(YsWxzctxfyEntity::getAssetId, ysWxzctxfy.getAssetId());
+		YsWxzctxfyEntity dbYs = baseMapper.selectOne(wrapper);
+		if (dbYs != null && !Func.equals(dbYs.getId(), ysWxzctxfy.getId())) {
+			throw new ServiceException("资产已在预算中");
+		}
 		return this.updateById(ysWxzctxfy);
 	}
 
 	@Override
 	public void importWxzctxfy(MultipartFile file, Long xmId) {
+		if (Func.isNull(xmId)) {
+			throw new ServiceException("请选择研发项目");
+		}
+		XmVO xmVO = xmMapper.selectByXmId(xmId);
+		if (Func.isNull(xmVO)) {
+			throw new ServiceException("研发项目不存在");
+		}
 
+		//查询项目开始时间对应月份的五行资产清单
+		List<AssetEntity> dbAssetList = assetMapper.selectList(Wrappers.<AssetEntity>lambdaQuery().eq(AssetEntity::getYearAndMonth, DateUtil.format(xmVO.getXmkssj(), DateUtil.PATTERN_YYYYMM)));
+
+		if (Func.isEmpty(dbAssetList)) {
+			throw new ServiceException(xmVO.getXmkssj() + "资产清单无数据");
+		}
+
+		List<YsWxzctxfyExcel> dataList = ExcelUtil.read(file, 4, 3, YsWxzctxfyExcel.class);
+		if (Func.isEmpty(dataList)) {
+			throw new ServiceException("读取导入数据失败,请检查数据");
+		}
+		List<YsWxzctxfyEntity> dbYsList = baseMapper.selectList(Wrappers.<YsWxzctxfyEntity>lambdaQuery().eq(YsWxzctxfyEntity::getXmId, xmId));
+
+		List<YsWxzctxfyEntity> insertList = new ArrayList<>();
+		int batchCount = 20;
+		for (YsWxzctxfyExcel excel : dataList) {
+
+			if (Func.isBlank(excel.getZcmc())) {
+				throw new ServiceException("序号[" + excel.getXh() + "]的资产名称为空");
+			}
+			YsWxzctxfyEntity entity = new YsWxzctxfyEntity();
+			entity.setXmId(xmId);
+
+			List<Long> list = dbAssetList.stream()
+				.filter(asset -> Func.equals(asset.getZcmc(), excel.getZcmc()))
+				.map(AssetEntity::getId).toList();
+			if (Func.isEmpty(list)) {
+				throw new ServiceException("资产[" + excel.getZcmc() + "]不存在");
+			}
+
+			if (dbYsList.stream().anyMatch(ys -> Func.equals(ys.getAssetId(), list.get(0)))) {
+				throw new ServiceException("序号[" + excel.getXh() + "]的资产已在预算表中");
+			}
+
+			BeanUtil.copyProperties(excel, entity);
+			entity.setAssetId(list.get(0));
+			insertList.add(entity);
+
+			if (insertList.size() % batchCount == 0 && this.saveBatch(insertList)) {
+				insertList.clear();
+			}
+		}
+
+		if (Func.isNotEmpty(insertList)) {
+			this.saveBatch(insertList);
+		}
+	}
+
+	@Override
+	public boolean saveWxzctxfy(YsWxzctxfyEntity ysWxzctxfy) {
+
+		if (ysWxzctxfy.getXmId() == null) {
+			throw new ServiceException("请选择科研项目");
+		}
+		LambdaQueryWrapper<YsWxzctxfyEntity> wrapper = Wrappers.<YsWxzctxfyEntity>lambdaQuery()
+			.eq(YsWxzctxfyEntity::getXmId, ysWxzctxfy.getXmId())
+			.eq(YsWxzctxfyEntity::getAssetId, ysWxzctxfy.getAssetId());
+		YsWxzctxfyEntity dbYs = baseMapper.selectOne(wrapper);
+		if (dbYs != null) {
+			throw new ServiceException("资产已在预算中");
+		}
+		return this.save(ysWxzctxfy);
 	}
 
 }

+ 40 - 5
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsZbtsysyfyServiceImpl.java

@@ -1,18 +1,23 @@
 
 package org.sky.scientific.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.AllArgsConstructor;
+import org.sky.core.excel.util.ExcelUtil;
 import org.sky.core.log.exception.ServiceException;
-import org.sky.scientific.pojo.entity.YsZbtsysyfyEntity;
-import org.sky.scientific.pojo.vo.YsZbtsysyfyVO;
+import org.sky.core.mp.base.BaseServiceImpl;
+import org.sky.core.tool.utils.Func;
 import org.sky.scientific.excel.YsZbtsysyfyExcel;
+import org.sky.scientific.mapper.XmMapper;
 import org.sky.scientific.mapper.YsZbtsysyfyMapper;
+import org.sky.scientific.pojo.entity.YsZbtsysyfyEntity;
+import org.sky.scientific.pojo.vo.YsZbtsysyfyVO;
 import org.sky.scientific.service.IYsZbtsysyfyService;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.sky.core.mp.base.BaseServiceImpl;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -22,8 +27,11 @@ import java.util.List;
  * @since 2025-06-29
  */
 @Service
+@AllArgsConstructor
 public class YsZbtsysyfyServiceImpl extends BaseServiceImpl<YsZbtsysyfyMapper, YsZbtsysyfyEntity> implements IYsZbtsysyfyService {
 
+	private final XmMapper xmMapper;
+
 	@Override
 	public IPage<YsZbtsysyfyVO> selectYsZbtsysyfyPage(IPage<YsZbtsysyfyVO> page, YsZbtsysyfyVO ysZbtsysyfy) {
 		return page.setRecords(baseMapper.selectYsZbtsysyfyPage(page, ysZbtsysyfy));
@@ -54,7 +62,34 @@ public class YsZbtsysyfyServiceImpl extends BaseServiceImpl<YsZbtsysyfyMapper, Y
 
 	@Override
 	public void importZbtsysyfy(MultipartFile file, Long xmId) {
+		if (Func.isNull(xmId)) {
+			throw new ServiceException("请选择研发项目");
+		}
+
+		List<YsZbtsysyfyExcel> dataList = ExcelUtil.read(file, 6, 3, YsZbtsysyfyExcel.class);
+		if (Func.isEmpty(dataList)) {
+			throw new ServiceException("读取导入数据失败,请检查数据");
+		}
+
+		List<YsZbtsysyfyEntity> insertList = new ArrayList<>();
+		int batchCount = 20;
+		for (YsZbtsysyfyExcel excel : dataList) {
 
+			YsZbtsysyfyEntity entity = new YsZbtsysyfyEntity();
+			entity.setXmId(xmId);
+			entity.setFyje(excel.getFyje());
+			entity.setYsje(excel.getYsje());
+
+			insertList.add(entity);
+
+			if (insertList.size() % batchCount == 0 && this.saveBatch(insertList)) {
+				insertList.clear();
+			}
+		}
+
+		if (Func.isNotEmpty(insertList)) {
+			this.saveBatch(insertList);
+		}
 	}
 
 }

+ 4 - 0
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/YsZjfyycqdtfyServiceImpl.java

@@ -91,6 +91,10 @@ public class YsZjfyycqdtfyServiceImpl extends BaseServiceImpl<YsZjfyycqdtfyMappe
 		List<YsZjfyycqdtfyEntity> insertList = new ArrayList<>();
 		int batchCount = 20;
 		for (YsZjfyycqdtfyExcel excel : dataList) {
+
+			if(Func.isBlank(excel.getZcmc())){
+				throw new ServiceException("序号["+excel.getXh()+"]的资产名称为空");
+			}
 			YsZjfyycqdtfyEntity entity = new YsZjfyycqdtfyEntity();
 			entity.setXmId(xmId);
 

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

@@ -89,7 +89,7 @@ public class YsZjtrfyServiceImpl extends BaseServiceImpl<YsZjtrfyMapper, YsZjtrf
 			YsZjtrfyEntity entity = new YsZjtrfyEntity();
 			entity.setXmId(xmId);
 			BeanUtil.copyProperties(excel, entity);
-
+			insertList.add(entity);
 			if (insertList.size() % batchCount == 0 && this.saveBatch(insertList)) {
 				insertList.clear();
 			}

+ 0 - 6
kd-service/kd-system/src/main/java/org/sky/system/controller/DictBizController.java

@@ -192,11 +192,5 @@ public class DictBizController extends KdController {
 		return R.data(list);
 	}
 
-	@GetMapping("/{code}/{dictValue}")
-	@ApiOperationSupport(order = 12)
-	@Operation(summary = "获取code字典的dictValue配置项")
-	public R<String> getByCodeAndDictValue(@PathVariable("code") String code, @PathVariable("dictValue") String dictValue){
-		return R.data(dictService.getByCodeAndDictValue(code, dictValue));
-	}
 
 }

+ 7 - 0
kd-service/kd-system/src/main/java/org/sky/system/controller/DictController.java

@@ -207,4 +207,11 @@ public class DictController extends KdController {
 	}
 
 
+	@GetMapping("/{code}/{dictKey}")
+	@ApiOperationSupport(order = 13)
+	@Operation(summary = "获取code字典的dictValue配置项")
+	public R<String> getByCodeAndDictKey(@PathVariable("code") String code, @PathVariable("dictKey") String dictKey){
+		return R.data(dictService.getByCodeAndDictkey(code, dictKey));
+	}
+
 }

+ 0 - 3
kd-service/kd-system/src/main/java/org/sky/system/mapper/DictBizMapper.java

@@ -2,7 +2,6 @@ package org.sky.system.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Param;
 import org.sky.core.tenant.annotation.TenantIgnore;
 import org.sky.system.pojo.entity.DictBiz;
 import org.sky.system.pojo.vo.DictBizVO;
@@ -50,6 +49,4 @@ public interface DictBizMapper extends BaseMapper<DictBiz> {
 	 */
 	List<DictBizVO> parentTree();
 
-	@TenantIgnore
-    String getByCodeAndDictValue(@Param("code") String code, @Param("dictValue") String dictValue);
 }

+ 26 - 12
kd-service/kd-system/src/main/java/org/sky/system/mapper/DictBizMapper.xml

@@ -24,28 +24,42 @@
     </resultMap>
 
     <select id="getValue" resultType="java.lang.String">
-        select
-            dict_value
-        from kd_dict_biz where code = #{param2} and dict_key = #{param3} and is_deleted = 0
+        select dict_value
+        from kd_dict_biz
+        where code = #{param2}
+          and dict_key = #{param3}
+          and is_deleted = 0
     </select>
 
     <select id="getList" resultMap="dictResultMap">
-        select id, tenant_id, parent_id, code, dict_key, dict_value, sort, remark from kd_dict_biz where code = #{param2} and parent_id > 0 and is_sealed = 0 and is_deleted = 0
+        select id,
+               tenant_id,
+               parent_id,
+               code,
+               dict_key,
+               dict_value,
+               sort,
+               remark
+        from kd_dict_biz
+        where code = #{param2}
+          and parent_id > 0
+          and is_sealed = 0
+          and is_deleted = 0
     </select>
 
     <select id="tree" resultMap="treeNodeResultMap">
-        select id, parent_id, dict_value as title, id as "value", id as "key" from kd_dict_biz where is_deleted = 0
+        select id, parent_id, dict_value as title, id as "value", id as "key"
+        from kd_dict_biz
+        where is_deleted = 0
     </select>
 
     <select id="parentTree" resultMap="treeNodeResultMap">
-        select id, parent_id, dict_value as title, id as "value", id as "key" from kd_dict_biz where is_deleted = 0 and parent_id = 0
+        select id, parent_id, dict_value as title, id as "value", id as "key"
+        from kd_dict_biz
+        where is_deleted = 0
+          and parent_id = 0
     </select>
 
-    <select id="getByCodeAndDictValue" resultType="java.lang.String">
-        SELECT k.dict_key
-        FROM kd_dict_biz b
-                 LEFT JOIN kd_dict_biz k on k.parent_id = b.id and k.dict_value=#{dictValue}
-        WHERE b.code = #{code} and b.parent_id =0
-    </select>
+
 
 </mapper>

+ 3 - 0
kd-service/kd-system/src/main/java/org/sky/system/mapper/DictMapper.java

@@ -2,6 +2,7 @@ package org.sky.system.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
 import org.sky.system.pojo.entity.Dict;
 import org.sky.system.pojo.vo.DictVO;
 
@@ -53,4 +54,6 @@ public interface DictMapper extends BaseMapper<Dict> {
 	 */
 	List<DictVO> parentTree();
 
+	String getByCodeAndDictKey(@Param("code") String code, @Param("dictKey") String dictKey);
+
 }

+ 8 - 0
kd-service/kd-system/src/main/java/org/sky/system/mapper/DictMapper.xml

@@ -44,4 +44,12 @@
         select id, parent_id, dict_value as title, id as "value", id as "key" from kd_dict where is_deleted = 0 and parent_id = 0
     </select>
 
+    <select id="getByCodeAndDictKey" resultType="java.lang.String">
+        SELECT dict_value
+        FROM kd_dict
+        WHERE code = #{code}
+          and dict_key = #{dictValue}
+          and parent_id != 0
+    </select>
+
 </mapper>

+ 0 - 1
kd-service/kd-system/src/main/java/org/sky/system/service/IDictBizService.java

@@ -101,5 +101,4 @@ public interface IDictBizService extends IService<DictBiz> {
 	 */
 	List<DictBizVO> childList(Map<String, Object> dict, Long parentId);
 
-    String getByCodeAndDictValue(String code, String dictValue);
 }

+ 1 - 0
kd-service/kd-system/src/main/java/org/sky/system/service/IDictService.java

@@ -89,4 +89,5 @@ public interface IDictService extends IService<Dict> {
 	 */
 	List<DictVO> childList(Map<String, Object> dict, Long parentId);
 
+	String getByCodeAndDictkey(String code, String dictKey);
 }

+ 0 - 4
kd-service/kd-system/src/main/java/org/sky/system/service/impl/DictBizServiceImpl.java

@@ -125,8 +125,4 @@ public class DictBizServiceImpl extends ServiceImpl<DictBizMapper, DictBiz> impl
 		return DictBizWrapper.build().listNodeVO(list);
 	}
 
-	@Override
-	public String getByCodeAndDictValue(String code, String dictValue) {
-		return baseMapper.getByCodeAndDictValue(code,dictValue);
-	}
 }

+ 5 - 0
kd-service/kd-system/src/main/java/org/sky/system/service/impl/DictServiceImpl.java

@@ -111,4 +111,9 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements ID
 		List<Dict> list = this.list(Condition.getQueryWrapper(dict, Dict.class).lambda().ne(Dict::getId, parentId).eq(Dict::getCode, parentDict.getCode()).orderByAsc(Dict::getSort));
 		return DictWrapper.build().listNodeVO(list);
 	}
+
+    @Override
+    public String getByCodeAndDictkey(String code, String dictKey) {
+        return baseMapper.getByCodeAndDictKey(code, dictKey);
+    }
 }