|
|
@@ -8,6 +8,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
import com.alibaba.excel.write.metadata.fill.FillConfig;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.SneakyThrows;
|
|
|
@@ -22,6 +23,7 @@ import org.sky.scientific.mapper.SubjectMapper;
|
|
|
import org.sky.scientific.mapper.XmMapper;
|
|
|
import org.sky.scientific.mapper.XmOtherCostMapper;
|
|
|
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.service.IXmOtherCostService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -65,7 +67,7 @@ public class XmOtherCostServiceImpl extends BaseServiceImpl<XmOtherCostMapper, X
|
|
|
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)) {
|
|
|
throw new ServiceException("导入数据为空");
|
|
|
}
|
|
|
@@ -74,14 +76,6 @@ public class XmOtherCostServiceImpl extends BaseServiceImpl<XmOtherCostMapper, X
|
|
|
for (XmOtherCostExcel data : dataList) {
|
|
|
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))) {
|
|
|
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())) {
|
|
|
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
|
|
|
Long xmId = xmMapper.getXmIdByXmmcOrXmbh(yearAndMonth, data.getXmmc(), data.getXmbh());
|
|
|
if (xmId == null) {
|