|
@@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 研发项目无形资产表 服务实现类
|
|
* 研发项目无形资产表 服务实现类
|
|
@@ -77,22 +78,30 @@ public class XmIntangibleAssetServiceImpl extends BaseServiceImpl<XmIntangibleAs
|
|
|
List<XmIntangibleAsset> lastMonthList = baseMapper.selectListByYearAndMonth(DateUtil.format(lastDate, DateUtil.PATTERN_YYYYMM));
|
|
List<XmIntangibleAsset> lastMonthList = baseMapper.selectListByYearAndMonth(DateUtil.format(lastDate, DateUtil.PATTERN_YYYYMM));
|
|
|
|
|
|
|
|
List<String> zcbmList = thisMonthList.stream().map(XmIntangibleAsset::getZcbm).toList();
|
|
List<String> zcbmList = thisMonthList.stream().map(XmIntangibleAsset::getZcbm).toList();
|
|
|
|
|
+ Map<Long, List<XmIntangibleAsset>> c1 = thisMonthList.stream().collect(Collectors.groupingBy(XmIntangibleAsset::getXmId));
|
|
|
|
|
+
|
|
|
if (!CollectionUtil.isEmpty(lastMonthList)) {
|
|
if (!CollectionUtil.isEmpty(lastMonthList)) {
|
|
|
//复制上个月数据到本月
|
|
//复制上个月数据到本月
|
|
|
List<XmIntangibleAsset> insertList = new ArrayList<>();
|
|
List<XmIntangibleAsset> insertList = new ArrayList<>();
|
|
|
for (XmIntangibleAsset dbAsset : lastMonthList) {
|
|
for (XmIntangibleAsset dbAsset : lastMonthList) {
|
|
|
//本月为包含dbAsset,新增
|
|
//本月为包含dbAsset,新增
|
|
|
- if (Func.contains(new List[]{zcbmList}, dbAsset.getZcbm())) {
|
|
|
|
|
|
|
+// if (!Func.contains(new List[]{zcbmList}, dbAsset.getZcbm())) {
|
|
|
|
|
+ if(Func.isNotEmpty(c1.get(dbAsset.getXmId())) && c1.get(dbAsset.getXmId()).stream().anyMatch(item -> Func.equals(item.getZcbm(), dbAsset.getZcbm()))){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+// if (!Func.contains(new List[]{zcbmList}, dbAsset.getZcbm())) {
|
|
|
XmIntangibleAsset asset = new XmIntangibleAsset();
|
|
XmIntangibleAsset asset = new XmIntangibleAsset();
|
|
|
asset.setYearAndMonth(yearAndMonth);
|
|
asset.setYearAndMonth(yearAndMonth);
|
|
|
asset.setXmId(dbAsset.getXmId());
|
|
asset.setXmId(dbAsset.getXmId());
|
|
|
asset.setAssetId(dbAsset.getAssetId());
|
|
asset.setAssetId(dbAsset.getAssetId());
|
|
|
asset.setZcbm(dbAsset.getZcbm());
|
|
asset.setZcbm(dbAsset.getZcbm());
|
|
|
insertList.add(asset);
|
|
insertList.add(asset);
|
|
|
- }
|
|
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
if (CollectionUtil.isNotEmpty(insertList)) {
|
|
if (CollectionUtil.isNotEmpty(insertList)) {
|
|
|
return this.saveBatch(insertList);
|
|
return this.saveBatch(insertList);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ throw new ServiceException("无数据可引入");
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
//若无,则获取预算表中的无形资产,研发项目周期(含变更)包含本月的
|
|
//若无,则获取预算表中的无形资产,研发项目周期(含变更)包含本月的
|
|
@@ -102,7 +111,10 @@ public class XmIntangibleAssetServiceImpl extends BaseServiceImpl<XmIntangibleAs
|
|
|
}
|
|
}
|
|
|
List<XmIntangibleAsset> insertList = new ArrayList<>();
|
|
List<XmIntangibleAsset> insertList = new ArrayList<>();
|
|
|
for (YsWxzctxfyVO ys : ysList) {
|
|
for (YsWxzctxfyVO ys : ysList) {
|
|
|
- if (CollectionUtil.isNotEmpty(zcbmList) && zcbmList.contains(ys.getZcbm())) {
|
|
|
|
|
|
|
+// if (CollectionUtil.isNotEmpty(zcbmList) && zcbmList.contains(ys.getZcbm())) {
|
|
|
|
|
+// continue;
|
|
|
|
|
+// }
|
|
|
|
|
+ if(Func.isNotEmpty(c1.get(ys.getXmId())) && c1.get(ys.getXmId()).stream().anyMatch(item -> Func.equals(item.getZcbm(), ys.getZcbm()))){
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
XmIntangibleAsset asset = new XmIntangibleAsset();
|
|
XmIntangibleAsset asset = new XmIntangibleAsset();
|
|
@@ -114,9 +126,10 @@ public class XmIntangibleAssetServiceImpl extends BaseServiceImpl<XmIntangibleAs
|
|
|
}
|
|
}
|
|
|
if (CollectionUtil.isNotEmpty(insertList)) {
|
|
if (CollectionUtil.isNotEmpty(insertList)) {
|
|
|
return this.saveBatch(insertList);
|
|
return this.saveBatch(insertList);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ throw new ServiceException("无数据可引入");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return true;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|