|
|
@@ -49,29 +49,29 @@ public class XmFinanceServiceImpl extends BaseServiceImpl<XmFinanceMapper, XmFin
|
|
|
if (entity.getType() == null || !Arrays.asList(1, 2, 3).contains(entity.getType())) {
|
|
|
throw new ServiceException("参数type为空或者错误");
|
|
|
}
|
|
|
- //根据yearAndMonth查询年度项目
|
|
|
- List<XmEntity> xmListByYear = xmMapper.selectXmListByYear(entity.getYearAndMonth());
|
|
|
- if (Func.isEmpty(xmListByYear)) {
|
|
|
- throw new ServiceException(entity.getYearAndMonth() + "年度内无研发项目可新增");
|
|
|
- }
|
|
|
-
|
|
|
- //根据yearAndMonth和type查询已有项目
|
|
|
- List<XmFinanceEntity> dbXmFinanceList = baseMapper.selectXmFinanceList(entity);
|
|
|
-
|
|
|
- //年度研发项目
|
|
|
- List<Long> xmIdList = xmListByYear.stream().map(XmEntity::getId).toList();
|
|
|
-
|
|
|
- //已添加的研发项目
|
|
|
- List<Long> XmIdFinances = dbXmFinanceList.stream().map(XmFinanceEntity::getXmId).toList();
|
|
|
- //去重,差集
|
|
|
- List<Long> collect = xmIdList.stream().filter(item -> !XmIdFinances.contains(item)).toList();
|
|
|
-
|
|
|
- if (Func.isEmpty(collect)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
+// //根据yearAndMonth查询年度项目
|
|
|
+// List<XmEntity> xmListByYear = xmMapper.selectXmListByYear(entity.getYearAndMonth());
|
|
|
+// if (Func.isEmpty(xmListByYear)) {
|
|
|
+// throw new ServiceException(entity.getYearAndMonth() + "年度内无研发项目可新增");
|
|
|
+// }
|
|
|
+//
|
|
|
+// //根据yearAndMonth和type查询已有项目
|
|
|
+// List<XmFinanceEntity> dbXmFinanceList = baseMapper.selectXmFinanceList(entity);
|
|
|
+//
|
|
|
+// //年度研发项目
|
|
|
+// List<Long> xmIdList = xmListByYear.stream().map(XmEntity::getId).toList();
|
|
|
+//
|
|
|
+// //已添加的研发项目
|
|
|
+// List<Long> XmIdFinances = dbXmFinanceList.stream().map(XmFinanceEntity::getXmId).toList();
|
|
|
+// //去重,差集
|
|
|
+// List<Long> collect = xmIdList.stream().filter(item -> !XmIdFinances.contains(item)).toList();
|
|
|
+//
|
|
|
+// if (Func.isEmpty(collect)) {
|
|
|
+// return true;
|
|
|
+// }
|
|
|
|
|
|
List<XmFinanceEntity> list = new ArrayList<>();
|
|
|
- for (Long xmId :collect) {
|
|
|
+ for (Long xmId : entity.getXmIdList()) {
|
|
|
XmFinanceEntity finance = new XmFinanceEntity();
|
|
|
finance.setYearAndMonth(entity.getYearAndMonth());
|
|
|
finance.setXmId(xmId);
|