|
|
@@ -2,6 +2,7 @@
|
|
|
package org.sky.scientific.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import jakarta.annotation.Resource;
|
|
|
@@ -23,16 +24,14 @@ import org.sky.scientific.pojo.entity.TechnicianEntity;
|
|
|
import org.sky.scientific.pojo.entity.XmTechnicianMonthlyEntity;
|
|
|
import org.sky.scientific.pojo.entity.YsRyrgfyEntity;
|
|
|
import org.sky.scientific.pojo.vo.TechnicianVO;
|
|
|
+import org.sky.scientific.pojo.vo.XmTechnicianSummary;
|
|
|
import org.sky.scientific.service.ITechnicianService;
|
|
|
import org.sky.system.cache.DictCache;
|
|
|
import org.sky.system.pojo.enums.DictEnum;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -167,10 +166,14 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
|
|
|
monthlyEntity.setYearAndMonth(entity.getYearAndMonth());
|
|
|
monthlyEntity.setCreateUser(SecureUtil.getUserId());
|
|
|
monthlyEntity.setUpdateUser(SecureUtil.getUserId());
|
|
|
-// if(xmTechnicianMonthlyMapper.selectCount(Wrappers.<XmTechnicianMonthlyEntity>lambdaQuery().eq(XmTechnicianMonthlyEntity::getYearAndMonth, entity.getYearAndMonth()).eq(XmTechnicianMonthlyEntity::getTechnicianId, technicianId)) == 0){
|
|
|
-// xmTechnicianMonthlyMapper.insert(monthlyEntity);
|
|
|
-// }
|
|
|
- xmTechnicianMonthlyMapper.insertOrUpdate(monthlyEntity);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<XmTechnicianMonthlyEntity> wrapper = Wrappers.<XmTechnicianMonthlyEntity>lambdaQuery().
|
|
|
+ eq(XmTechnicianMonthlyEntity::getYearAndMonth, entity.getYearAndMonth()).
|
|
|
+ eq(XmTechnicianMonthlyEntity::getTechnicianId, technicianId).
|
|
|
+ eq(XmTechnicianMonthlyEntity::getXmId, entity.getXmId());
|
|
|
+ if(xmTechnicianMonthlyMapper.selectCount(wrapper) == 0) {
|
|
|
+ xmTechnicianMonthlyMapper.insert(monthlyEntity);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -182,10 +185,15 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
|
|
|
@Override
|
|
|
public boolean submitXmTechnicianMonthly(XmTechnicianMonthlyEntity entity) {
|
|
|
int affectNum = 0;
|
|
|
+ entity.setId(null);
|
|
|
entity.setYearAndMonth(entity.getYearAndMonth());
|
|
|
entity.setCreateUser(SecureUtil.getUserId());
|
|
|
entity.setUpdateUser(SecureUtil.getUserId());
|
|
|
- if(xmTechnicianMonthlyMapper.selectCount(Wrappers.<XmTechnicianMonthlyEntity>lambdaQuery().eq(XmTechnicianMonthlyEntity::getYearAndMonth, entity.getYearAndMonth()).eq(XmTechnicianMonthlyEntity::getTechnicianId, entity.getTechnicianId())) == 0) {
|
|
|
+ LambdaQueryWrapper<XmTechnicianMonthlyEntity> wrapper = Wrappers.<XmTechnicianMonthlyEntity>lambdaQuery().
|
|
|
+ eq(XmTechnicianMonthlyEntity::getYearAndMonth, entity.getYearAndMonth()).
|
|
|
+ eq(XmTechnicianMonthlyEntity::getTechnicianId, entity.getTechnicianId()).
|
|
|
+ eq(XmTechnicianMonthlyEntity::getXmId, entity.getXmId());
|
|
|
+ if(xmTechnicianMonthlyMapper.selectCount(wrapper) == 0) {
|
|
|
affectNum = xmTechnicianMonthlyMapper.insert(entity);
|
|
|
}else{
|
|
|
throw new ServiceException("科技人员已是项目在["+entity.getYearAndMonth()+"]的参研人员,请勿重复新增");
|
|
|
@@ -231,4 +239,10 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
|
|
|
List<TechnicianEntity> list = baseMapper.selectByDateInterval(page, param);
|
|
|
return page.setRecords(list);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<XmTechnicianSummary> xiangmucanyanrenyuanhuizongbiao(IPage<XmTechnicianSummary> page, XmTechnicianMonthlyEntity entity) {
|
|
|
+ List<XmTechnicianSummary> summary = xmTechnicianMonthlyMapper.xmTechnicianSummary(page, entity);
|
|
|
+ return page.setRecords(summary);
|
|
|
+ }
|
|
|
}
|