|
@@ -8,6 +8,7 @@ import lombok.AllArgsConstructor;
|
|
|
import org.sky.core.excel.util.ExcelUtil;
|
|
import org.sky.core.excel.util.ExcelUtil;
|
|
|
import org.sky.core.log.exception.ServiceException;
|
|
import org.sky.core.log.exception.ServiceException;
|
|
|
import org.sky.core.mp.base.BaseServiceImpl;
|
|
import org.sky.core.mp.base.BaseServiceImpl;
|
|
|
|
|
+import org.sky.core.secure.utils.SecureUtil;
|
|
|
import org.sky.core.tool.utils.*;
|
|
import org.sky.core.tool.utils.*;
|
|
|
import org.sky.scientific.excel.XmCostDetailsExcel;
|
|
import org.sky.scientific.excel.XmCostDetailsExcel;
|
|
|
import org.sky.scientific.mapper.SubjectEnterpriseMapper;
|
|
import org.sky.scientific.mapper.SubjectEnterpriseMapper;
|
|
@@ -17,14 +18,13 @@ import org.sky.scientific.mapper.XmMapper;
|
|
|
import org.sky.scientific.pojo.dto.XmCostDetailsDTO;
|
|
import org.sky.scientific.pojo.dto.XmCostDetailsDTO;
|
|
|
import org.sky.scientific.pojo.entity.SubjectEnterprise;
|
|
import org.sky.scientific.pojo.entity.SubjectEnterprise;
|
|
|
import org.sky.scientific.pojo.entity.XmCostDetailsEntity;
|
|
import org.sky.scientific.pojo.entity.XmCostDetailsEntity;
|
|
|
|
|
+import org.sky.scientific.pojo.vo.FinanceCostDetailVO;
|
|
|
|
|
+import org.sky.scientific.pojo.vo.FinanceCostItemVO;
|
|
|
import org.sky.scientific.service.IXmCostDetailsService;
|
|
import org.sky.scientific.service.IXmCostDetailsService;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 研发费用支出明细账 服务实现类
|
|
* 研发费用支出明细账 服务实现类
|
|
@@ -42,15 +42,15 @@ public class XmCostDetailsServiceImpl extends BaseServiceImpl<XmCostDetailsMappe
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public IPage<XmCostDetailsEntity> selectXmCostDetailsPage(IPage<XmCostDetailsEntity> page, XmCostDetailsDTO dto) {
|
|
public IPage<XmCostDetailsEntity> selectXmCostDetailsPage(IPage<XmCostDetailsEntity> page, XmCostDetailsDTO dto) {
|
|
|
- if(Func.isBlank(dto.getYearAndMonth())){
|
|
|
|
|
|
|
+ if (Func.isBlank(dto.getYearAndMonth())) {
|
|
|
throw new ServiceException("参数yearAndMonth不能为空");
|
|
throw new ServiceException("参数yearAndMonth不能为空");
|
|
|
}
|
|
}
|
|
|
List<XmCostDetailsEntity> list = null;
|
|
List<XmCostDetailsEntity> list = null;
|
|
|
- if(dto.getYearAndMonth().length() == 6){
|
|
|
|
|
|
|
+ if (dto.getYearAndMonth().length() == 6) {
|
|
|
list = baseMapper.selectPageByYearAndMonth(page, dto);
|
|
list = baseMapper.selectPageByYearAndMonth(page, dto);
|
|
|
- }else if(dto.getYearAndMonth().length() == 4){
|
|
|
|
|
|
|
+ } else if (dto.getYearAndMonth().length() == 4) {
|
|
|
list = baseMapper.selectPageByYear(page, dto);
|
|
list = baseMapper.selectPageByYear(page, dto);
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
throw new ServiceException("参数yearAndMonth格式错误,yyyyMM或yyyy");
|
|
throw new ServiceException("参数yearAndMonth格式错误,yyyyMM或yyyy");
|
|
|
}
|
|
}
|
|
|
return page.setRecords(list);
|
|
return page.setRecords(list);
|
|
@@ -94,13 +94,13 @@ public class XmCostDetailsServiceImpl extends BaseServiceImpl<XmCostDetailsMappe
|
|
|
judgeDate(excel.getRecordDate(), yearAndMonth);
|
|
judgeDate(excel.getRecordDate(), yearAndMonth);
|
|
|
|
|
|
|
|
if (Func.isBlank(excel.getXmmc())) {
|
|
if (Func.isBlank(excel.getXmmc())) {
|
|
|
- throw new ServiceException("序号["+excel.getSerialNumber()+"]的研发项目名称不能为空");
|
|
|
|
|
|
|
+ throw new ServiceException("序号[" + excel.getSerialNumber() + "]的研发项目名称不能为空");
|
|
|
}
|
|
}
|
|
|
- if(Func.isBlank(excel.getESubjectCode())){
|
|
|
|
|
- throw new ServiceException("序号["+excel.getSerialNumber()+"]的企业科目代码不能为空");
|
|
|
|
|
|
|
+ if (Func.isBlank(excel.getESubjectCode())) {
|
|
|
|
|
+ throw new ServiceException("序号[" + excel.getSerialNumber() + "]的企业科目代码不能为空");
|
|
|
}
|
|
}
|
|
|
- if(Func.isBlank(excel.getESubjectName())){
|
|
|
|
|
- throw new ServiceException("序号["+excel.getSerialNumber()+"]的企业科目名称不能为空");
|
|
|
|
|
|
|
+ if (Func.isBlank(excel.getESubjectName())) {
|
|
|
|
|
+ throw new ServiceException("序号[" + excel.getSerialNumber() + "]的企业科目名称不能为空");
|
|
|
}
|
|
}
|
|
|
// if(excel.getSubjectName().contains("\\") && excel.getSubjectName().split("\\\\").length != 4){
|
|
// if(excel.getSubjectName().contains("\\") && excel.getSubjectName().split("\\\\").length != 4){
|
|
|
// throw new ServiceException("序号["+excel.getSerialNumber()+"]的科目名称应该为四级科目");
|
|
// throw new ServiceException("序号["+excel.getSerialNumber()+"]的科目名称应该为四级科目");
|
|
@@ -116,8 +116,8 @@ public class XmCostDetailsServiceImpl extends BaseServiceImpl<XmCostDetailsMappe
|
|
|
|
|
|
|
|
// Subject dbSubject = subjectMapper.selectOne(Wrappers.<Subject>lambdaQuery().eq(Subject::getCode, excel.getSubjectCode()));
|
|
// Subject dbSubject = subjectMapper.selectOne(Wrappers.<Subject>lambdaQuery().eq(Subject::getCode, excel.getSubjectCode()));
|
|
|
SubjectEnterprise dbSubject = subjectEnterpriseMapper.selectOne(Wrappers.<SubjectEnterprise>lambdaQuery().eq(SubjectEnterprise::getCode, excel.getESubjectCode()));
|
|
SubjectEnterprise dbSubject = subjectEnterpriseMapper.selectOne(Wrappers.<SubjectEnterprise>lambdaQuery().eq(SubjectEnterprise::getCode, excel.getESubjectCode()));
|
|
|
- if(Func.isNull(dbSubject)){
|
|
|
|
|
- throw new ServiceException("序号["+excel.getSerialNumber()+"]的企业科目代码不存在");
|
|
|
|
|
|
|
+ if (Func.isNull(dbSubject)) {
|
|
|
|
|
+ throw new ServiceException("序号[" + excel.getSerialNumber() + "]的企业科目代码不存在");
|
|
|
}
|
|
}
|
|
|
entity.setESubjectId(dbSubject.getId());
|
|
entity.setESubjectId(dbSubject.getId());
|
|
|
entity.setESubjectCode(dbSubject.getCode());
|
|
entity.setESubjectCode(dbSubject.getCode());
|
|
@@ -132,7 +132,7 @@ public class XmCostDetailsServiceImpl extends BaseServiceImpl<XmCostDetailsMappe
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(Func.isNotEmpty(insertList)){
|
|
|
|
|
|
|
+ if (Func.isNotEmpty(insertList)) {
|
|
|
this.saveBatch(insertList);
|
|
this.saveBatch(insertList);
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
@@ -143,6 +143,48 @@ public class XmCostDetailsServiceImpl extends BaseServiceImpl<XmCostDetailsMappe
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<FinanceCostDetailVO> financeCostDetail(XmCostDetailsDTO dto) {
|
|
|
|
|
+ if (Func.isBlank(dto.getYearAndMonth())) {
|
|
|
|
|
+ throw new ServiceException("参数yearAndMonth不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ dto.setTenantId(SecureUtil.getTenantId());
|
|
|
|
|
+ List<FinanceCostDetailVO> list = baseMapper.financeCostDetail(dto);
|
|
|
|
|
+ for (FinanceCostDetailVO tmp : list) {
|
|
|
|
|
+ List<FinanceCostItemVO> vos = tmp.getCostList();
|
|
|
|
|
+ for (FinanceCostItemVO vo : vos) {
|
|
|
|
|
+ if(Arrays.asList("53010101","53010201").contains(vo.getSubjectCode())){
|
|
|
|
|
+ //人员人工费用
|
|
|
|
|
+ vo.setRyrg(vo.getAmount().doubleValue());
|
|
|
|
|
+ }else if(Arrays.asList("53010102","53010202").contains(vo.getSubjectCode())){
|
|
|
|
|
+ //直接投入费用
|
|
|
|
|
+ vo.setZjtr(vo.getAmount().doubleValue());
|
|
|
|
|
+ }else if(Arrays.asList("53010103","53010203").contains(vo.getSubjectCode())){
|
|
|
|
|
+ //折旧费用与长期待摊费用
|
|
|
|
|
+ vo.setZjfyycqdtfy(vo.getAmount().doubleValue());
|
|
|
|
|
+ }else if(Arrays.asList("53010104","53010204").contains(vo.getSubjectCode())){
|
|
|
|
|
+ //无形资产摊销费用
|
|
|
|
|
+ vo.setWxzctx(vo.getAmount().doubleValue());
|
|
|
|
|
+ }else if(Arrays.asList("53010105","53010205").contains(vo.getSubjectCode())){
|
|
|
|
|
+ //设计费用
|
|
|
|
|
+ vo.setSjf(vo.getAmount().doubleValue());
|
|
|
|
|
+ }else if(Arrays.asList("53010106","53010206").contains(vo.getSubjectCode())){
|
|
|
|
|
+ //装备调试费用与试验费用
|
|
|
|
|
+ vo.setZbtsfyysyfy(vo.getAmount().doubleValue());
|
|
|
|
|
+ }else if(Arrays.asList("53010107","53010207").contains(vo.getSubjectCode())){
|
|
|
|
|
+ //委托外部研究开发费用
|
|
|
|
|
+ vo.setWwyf(vo.getAmount().doubleValue());
|
|
|
|
|
+ }else if(Arrays.asList("53010108","53010208").contains(vo.getSubjectCode())){
|
|
|
|
|
+ //其他费用
|
|
|
|
|
+ vo.setQtfy(vo.getAmount().doubleValue());
|
|
|
|
|
+ }else {
|
|
|
|
|
+ throw new ServiceException("费用归集出错啦");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static void judgeDate(Date date, String yearAndMonth) {
|
|
public static void judgeDate(Date date, String yearAndMonth) {
|
|
|
//日期,必须时当月日期
|
|
//日期,必须时当月日期
|
|
|
if (date != null) {
|
|
if (date != null) {
|