|
|
@@ -1,16 +1,27 @@
|
|
|
|
|
|
package org.sky.scientific.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import jakarta.validation.constraints.Email;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.ibatis.executor.BatchResult;
|
|
|
+import org.glassfish.jaxb.core.v2.TODO;
|
|
|
import org.sky.core.log.exception.ServiceException;
|
|
|
import org.sky.core.mp.base.BaseServiceImpl;
|
|
|
import org.sky.core.secure.utils.AuthUtil;
|
|
|
+import org.sky.core.secure.utils.SecureUtil;
|
|
|
import org.sky.core.tool.utils.*;
|
|
|
import org.sky.scientific.excel.TechnicianExcel;
|
|
|
import org.sky.scientific.mapper.TechnicianMapper;
|
|
|
+import org.sky.scientific.mapper.XmTechnicianMonthlyMapper;
|
|
|
+import org.sky.scientific.mapper.YsRyrgfyMapper;
|
|
|
import org.sky.scientific.pojo.dto.TechnicianDTO;
|
|
|
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.service.ITechnicianService;
|
|
|
import org.sky.system.cache.DictCache;
|
|
|
@@ -18,8 +29,11 @@ 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.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 技术人员花名册 服务实现类
|
|
|
@@ -31,6 +45,11 @@ import java.util.Objects;
|
|
|
@Service
|
|
|
public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, TechnicianEntity> implements ITechnicianService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private YsRyrgfyMapper ysRyrgfyMapper;
|
|
|
+ @Resource
|
|
|
+ private XmTechnicianMonthlyMapper xmTechnicianMonthlyMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public boolean saveOrUpdateTechnician(TechnicianEntity technician) {
|
|
|
int affectNum = 0;
|
|
|
@@ -131,4 +150,85 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
|
|
|
}
|
|
|
return affectNum == technicianList.size();
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void zhijieyinyongyusuanbiaomingdan(XmTechnicianMonthlyEntity entity) {
|
|
|
+ //先根据xmId查询项目预算中的人员名单
|
|
|
+ List<YsRyrgfyEntity> ysRyrgfyEntityList = ysRyrgfyMapper.selectList(Wrappers.<YsRyrgfyEntity>lambdaQuery().eq(YsRyrgfyEntity::getXmId, entity.getXmId()));
|
|
|
+ if(CollectionUtil.isEmpty(ysRyrgfyEntityList)){
|
|
|
+ throw new ServiceException("该项目没有填写人员人工费用预算");
|
|
|
+ }
|
|
|
+ List<Long> technicianIdList = ysRyrgfyEntityList.stream().map(YsRyrgfyEntity::getTechnicianId).toList();
|
|
|
+ for (Long technicianId : technicianIdList) {
|
|
|
+ XmTechnicianMonthlyEntity monthlyEntity = new XmTechnicianMonthlyEntity();
|
|
|
+ monthlyEntity.setXmId(entity.getXmId());
|
|
|
+ monthlyEntity.setTechnicianId(technicianId);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<XmTechnicianMonthlyEntity> meiyueshijicanyuanrenyuanmingdan(XmTechnicianMonthlyEntity entity, IPage<Object> page) {
|
|
|
+ return xmTechnicianMonthlyMapper.meiyueshijicanyuanrenyuanmingdan(page, entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean submitXmTechnicianMonthly(XmTechnicianMonthlyEntity entity) {
|
|
|
+ int affectNum = 0;
|
|
|
+ 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) {
|
|
|
+ affectNum = xmTechnicianMonthlyMapper.insert(entity);
|
|
|
+ }else{
|
|
|
+ throw new ServiceException("科技人员已是项目在["+entity.getYearAndMonth()+"]的参研人员,请勿重复新增");
|
|
|
+ }
|
|
|
+ return affectNum == 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean physicalDeleteXmTechnicianMonthlyByIds(List<Long> ids) {
|
|
|
+ if(CollectionUtil.isEmpty(ids)){
|
|
|
+ throw new ServiceException("参数不能为空");
|
|
|
+ }
|
|
|
+ return xmTechnicianMonthlyMapper.physicalDeleteXmTechnicianMonthlyByIds(ids) == ids.size();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportXmTechnicianMonthly(XmTechnicianMonthlyEntity entity) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<TechnicianEntity> selectTechnicianPageByDateInterval(IPage<TechnicianEntity> page, HashMap<String,String> param) {
|
|
|
+ if(!param.containsKey("startDate") || !param.containsKey("endDate")){
|
|
|
+ throw new ServiceException("startDate或者endDate为空");
|
|
|
+ }
|
|
|
+ String startDate = param.get("startDate");
|
|
|
+ String endDate = param.get("endDate");
|
|
|
+ if(startDate.contains("-")){
|
|
|
+ startDate = startDate.replace("-", "");
|
|
|
+ }
|
|
|
+ if(endDate.contains("-")){
|
|
|
+ endDate = endDate.replace("-", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(startDate.length() == 8){
|
|
|
+ startDate = startDate.substring(0,6);
|
|
|
+ }
|
|
|
+ if(endDate.length() == 8){
|
|
|
+ endDate = endDate.substring(0,6);
|
|
|
+ }
|
|
|
+ param.put("startDate", startDate);
|
|
|
+ param.put("endDate", endDate);
|
|
|
+ List<TechnicianEntity> list = baseMapper.selectByDateInterval(page, param);
|
|
|
+ return page.setRecords(list);
|
|
|
+ }
|
|
|
}
|