项目进度控制
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package com.ruoyi.oa.service;
|
||||
|
||||
import com.ruoyi.oa.domain.vo.OaProjectScheduleVo;
|
||||
import com.ruoyi.oa.domain.bo.OaProjectScheduleBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目进度Service接口
|
||||
*
|
||||
* @author haka
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
public interface IOaProjectScheduleService {
|
||||
|
||||
/**
|
||||
* 查询项目进度
|
||||
*/
|
||||
OaProjectScheduleVo queryById(Long scheduleId);
|
||||
|
||||
/**
|
||||
* 查询项目进度列表
|
||||
*/
|
||||
TableDataInfo<OaProjectScheduleVo> queryPageList(OaProjectScheduleBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询项目进度列表
|
||||
*/
|
||||
List<OaProjectScheduleVo> queryList(OaProjectScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 新增项目进度
|
||||
*/
|
||||
Boolean insertByBo(OaProjectScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 修改项目进度
|
||||
*/
|
||||
Boolean updateByBo(OaProjectScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除项目进度信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 完成进度
|
||||
*
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
boolean complete(OaProjectScheduleBo bo);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.oa.service;
|
||||
|
||||
import com.ruoyi.oa.domain.OaProjectScheduleStep;
|
||||
import com.ruoyi.oa.domain.vo.OaProjectScheduleStepVo;
|
||||
import com.ruoyi.oa.domain.bo.OaProjectScheduleStepBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目进度步骤跟踪Service接口
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
public interface IOaProjectScheduleStepService {
|
||||
|
||||
/**
|
||||
* 查询项目进度步骤跟踪
|
||||
*/
|
||||
OaProjectScheduleStepVo queryById(Long trackId);
|
||||
|
||||
/**
|
||||
* 查询项目进度步骤跟踪列表
|
||||
*/
|
||||
TableDataInfo<OaProjectScheduleStepVo> queryPageList(OaProjectScheduleStepBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询项目进度步骤跟踪列表
|
||||
*/
|
||||
List<OaProjectScheduleStepVo> queryList(OaProjectScheduleStepBo bo);
|
||||
|
||||
/**
|
||||
* 新增项目进度步骤跟踪
|
||||
*/
|
||||
Boolean insertByBo(OaProjectScheduleStepBo bo);
|
||||
|
||||
/**
|
||||
* 修改项目进度步骤跟踪
|
||||
*/
|
||||
Boolean updateByBo(OaProjectScheduleStepBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除项目进度步骤跟踪信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
OaProjectScheduleStepVo maxStepByScheduleId(Long scheduleId);
|
||||
|
||||
void updateByStepAndScheduleId(Long currentStep,Long scheduleId);
|
||||
|
||||
OaProjectScheduleStepVo selectByCurrentStepAndScheduleId(Long currentStep, Long scheduleId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.ruoyi.oa.service;
|
||||
|
||||
import com.ruoyi.oa.domain.OaScheduleTemplate;
|
||||
import com.ruoyi.oa.domain.vo.OaScheduleTemplateVo;
|
||||
import com.ruoyi.oa.domain.bo.OaScheduleTemplateBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 进度模板主Service接口
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
public interface IOaScheduleTemplateService {
|
||||
|
||||
/**
|
||||
* 查询进度模板主
|
||||
*/
|
||||
OaScheduleTemplateVo queryById(Long templateId);
|
||||
|
||||
/**
|
||||
* 查询进度模板主列表
|
||||
*/
|
||||
TableDataInfo<OaScheduleTemplateVo> queryPageList(OaScheduleTemplateBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询进度模板主列表
|
||||
*/
|
||||
List<OaScheduleTemplateVo> queryList(OaScheduleTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 新增进度模板主
|
||||
*/
|
||||
Boolean insertByBo(OaScheduleTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 修改进度模板主
|
||||
*/
|
||||
Boolean updateByBo(OaScheduleTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除进度模板主信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.ruoyi.oa.service;
|
||||
|
||||
import com.ruoyi.oa.domain.OaScheduleTemplateStep;
|
||||
import com.ruoyi.oa.domain.vo.OaScheduleTemplateStepVo;
|
||||
import com.ruoyi.oa.domain.bo.OaScheduleTemplateStepBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 进度模板步骤Service接口
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
public interface IOaScheduleTemplateStepService {
|
||||
|
||||
/**
|
||||
* 查询进度模板步骤
|
||||
*/
|
||||
OaScheduleTemplateStepVo queryById(Long stepId);
|
||||
|
||||
/**
|
||||
* 查询进度模板步骤列表
|
||||
*/
|
||||
TableDataInfo<OaScheduleTemplateStepVo> queryPageList(OaScheduleTemplateStepBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询进度模板步骤列表
|
||||
*/
|
||||
List<OaScheduleTemplateStepVo> queryList(OaScheduleTemplateStepBo bo);
|
||||
|
||||
/**
|
||||
* 新增进度模板步骤
|
||||
*/
|
||||
Boolean insertByBo(OaScheduleTemplateStepBo bo);
|
||||
|
||||
/**
|
||||
* 修改进度模板步骤
|
||||
*/
|
||||
Boolean updateByBo(OaScheduleTemplateStepBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除进度模板步骤信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.oa.domain.OaProjectScheduleStep;
|
||||
import com.ruoyi.oa.domain.OaScheduleTemplate;
|
||||
import com.ruoyi.oa.domain.bo.OaProjectScheduleStepBo;
|
||||
import com.ruoyi.oa.domain.bo.OaScheduleTemplateStepBo;
|
||||
import com.ruoyi.oa.domain.vo.OaProjectScheduleStepVo;
|
||||
import com.ruoyi.oa.mapper.OaScheduleTemplateMapper;
|
||||
import com.ruoyi.oa.service.IOaProjectScheduleStepService;
|
||||
import com.ruoyi.oa.service.IOaScheduleTemplateStepService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.OaProjectScheduleBo;
|
||||
import com.ruoyi.oa.domain.vo.OaProjectScheduleVo;
|
||||
import com.ruoyi.oa.domain.OaProjectSchedule;
|
||||
import com.ruoyi.oa.mapper.OaProjectScheduleMapper;
|
||||
import com.ruoyi.oa.service.IOaProjectScheduleService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 项目进度Service业务层处理
|
||||
*
|
||||
* @author haka
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OaProjectScheduleServiceImpl implements IOaProjectScheduleService {
|
||||
|
||||
private final OaProjectScheduleMapper baseMapper;
|
||||
|
||||
private final OaScheduleTemplateMapper scheduleTemplateMapper;
|
||||
|
||||
private final IOaScheduleTemplateStepService scheduleTemplateStepService;
|
||||
|
||||
private final IOaProjectScheduleStepService projectScheduleStepService;
|
||||
|
||||
/**
|
||||
* 查询项目进度
|
||||
*/
|
||||
@Override
|
||||
public OaProjectScheduleVo queryById(Long scheduleId){
|
||||
return baseMapper.selectVoById(scheduleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目进度列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaProjectScheduleVo> queryPageList(OaProjectScheduleBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<OaProjectSchedule> lqw = buildQueryWrapper(bo);
|
||||
Page<OaProjectScheduleVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目进度列表
|
||||
*/
|
||||
@Override
|
||||
public List<OaProjectScheduleVo> queryList(OaProjectScheduleBo bo) {
|
||||
QueryWrapper<OaProjectSchedule> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private QueryWrapper<OaProjectSchedule> buildQueryWrapper(OaProjectScheduleBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
QueryWrapper<OaProjectSchedule> lqw = Wrappers.query();
|
||||
lqw.eq("ops.del_flag", 0);
|
||||
lqw.eq(bo.getProjectId() != null,"ops.project_id", bo.getProjectId());
|
||||
lqw.eq(bo.getTemplateId() != null, "ops.template_id", bo.getTemplateId());
|
||||
lqw.eq(bo.getCurrentStep() != null, "ops.current_step", bo.getCurrentStep());
|
||||
lqw.eq(bo.getStatus() != null, "ops.status", bo.getStatus());
|
||||
lqw.gt(bo.getPrePay()!=null&&bo.getPrePay()>0, "op.pre_pay", 0);
|
||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||
"op.begin_time", params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目进度
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OaProjectScheduleBo bo) {
|
||||
|
||||
if (bo.getMode().equals("custom")){
|
||||
// 生成模板
|
||||
OaScheduleTemplate oaScheduleTemplate = new OaScheduleTemplate();
|
||||
oaScheduleTemplate.setTemplateName("自动生成_"+ DateUtils.getTime() +"_"+LoginHelper.getNickName());
|
||||
oaScheduleTemplate.setStatus(1L);
|
||||
oaScheduleTemplate.setCreateBy(LoginHelper.getNickName());
|
||||
scheduleTemplateMapper.insert(oaScheduleTemplate);
|
||||
|
||||
// 生成模板对应的步骤
|
||||
Long templateId = oaScheduleTemplate.getTemplateId();
|
||||
for (int i = 1; i <= bo.getSteps().size(); i++) {
|
||||
OaScheduleTemplateStepBo step = getOaScheduleTemplateStepBo(bo, i, templateId);
|
||||
scheduleTemplateStepService.insertByBo(step);
|
||||
}
|
||||
bo.setTemplateId(templateId);
|
||||
}
|
||||
bo.setCurrentStep(1L);
|
||||
OaProjectSchedule add = BeanUtil.toBean(bo, OaProjectSchedule.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setScheduleId(add.getScheduleId());
|
||||
}
|
||||
|
||||
for (int i = 0; i < bo.getSteps().size(); i++) {
|
||||
|
||||
OaProjectScheduleStepBo step = bo.getSteps().get(i);
|
||||
step.setScheduleId(add.getScheduleId());
|
||||
step.setStepOrder((long) (i+1));
|
||||
if (i==0){
|
||||
step.setActualStart(new Date());
|
||||
}
|
||||
projectScheduleStepService.insertByBo(step);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private static OaScheduleTemplateStepBo getOaScheduleTemplateStepBo(OaProjectScheduleBo bo, int i, Long templateId) {
|
||||
OaProjectScheduleStepBo projectScheduleStep = bo.getSteps().get(i-1);
|
||||
OaScheduleTemplateStepBo step = new OaScheduleTemplateStepBo();
|
||||
step.setStepName(projectScheduleStep.getStepName());
|
||||
step.setDescription(projectScheduleStep.getDescription());
|
||||
step.setTemplateId(templateId);
|
||||
step.setStepOrder((long) i);
|
||||
step.setExpectedDays(projectScheduleStep.getExpectedDays());
|
||||
step.setCreateBy(LoginHelper.getNickName());
|
||||
return step;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目进度
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OaProjectScheduleBo bo) {
|
||||
OaProjectSchedule update = BeanUtil.toBean(bo, OaProjectSchedule.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OaProjectSchedule entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目进度
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean complete(OaProjectScheduleBo bo) {
|
||||
// 0首先判断是否到最后一部
|
||||
OaProjectScheduleStepVo scheduleStepVo = projectScheduleStepService.maxStepByScheduleId(bo.getScheduleId());
|
||||
// 此处被分为了两种情况
|
||||
if (scheduleStepVo.getStepOrder()>bo.getCurrentStep()){
|
||||
// 1未完成全部进度,此时将currentStep更新到下一位 然后将当前的step的完成标志status改为1标志完成
|
||||
projectScheduleStepService.updateByStepAndScheduleId(bo.getCurrentStep(),bo.getScheduleId());
|
||||
bo.setCurrentStep(bo.getCurrentStep()+1L);
|
||||
OaProjectScheduleStepVo stepVo = projectScheduleStepService.selectByCurrentStepAndScheduleId(bo.getCurrentStep()+1L,bo.getScheduleId());
|
||||
stepVo.setActualStart(new Date());
|
||||
OaProjectScheduleStepBo update = BeanUtil.toBean(stepVo, OaProjectScheduleStepBo.class);
|
||||
projectScheduleStepService.updateByBo(update);
|
||||
}else{
|
||||
// 2完成了全部进度,此时将此对象的status直接改为2代表完成了全部操作
|
||||
OaProjectScheduleStepVo stepVo = projectScheduleStepService.selectByCurrentStepAndScheduleId(bo.getCurrentStep(),bo.getScheduleId());
|
||||
OaProjectScheduleStepBo update = BeanUtil.toBean(stepVo, OaProjectScheduleStepBo.class);
|
||||
update.setActualEnd(new Date());
|
||||
projectScheduleStepService.updateByBo(update);
|
||||
bo.setStatus(2L);
|
||||
}
|
||||
return updateByBo(bo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.OaProjectScheduleStepBo;
|
||||
import com.ruoyi.oa.domain.vo.OaProjectScheduleStepVo;
|
||||
import com.ruoyi.oa.domain.OaProjectScheduleStep;
|
||||
import com.ruoyi.oa.mapper.OaProjectScheduleStepMapper;
|
||||
import com.ruoyi.oa.service.IOaProjectScheduleStepService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 项目进度步骤跟踪Service业务层处理
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OaProjectScheduleStepServiceImpl implements IOaProjectScheduleStepService {
|
||||
|
||||
private final OaProjectScheduleStepMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询项目进度步骤跟踪
|
||||
*/
|
||||
@Override
|
||||
public OaProjectScheduleStepVo queryById(Long trackId){
|
||||
return baseMapper.selectVoPlusById(trackId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目进度步骤跟踪列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaProjectScheduleStepVo> queryPageList(OaProjectScheduleStepBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<OaProjectScheduleStep> lqw = buildQueryWrapper(bo);
|
||||
Page<OaProjectScheduleStepVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目进度步骤跟踪列表
|
||||
*/
|
||||
@Override
|
||||
public List<OaProjectScheduleStepVo> queryList(OaProjectScheduleStepBo bo) {
|
||||
QueryWrapper<OaProjectScheduleStep> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private QueryWrapper<OaProjectScheduleStep> buildQueryWrapper(OaProjectScheduleStepBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
QueryWrapper<OaProjectScheduleStep> lqw = Wrappers.query();
|
||||
lqw.eq(bo.getScheduleId() != null, "opss.schedule_id", bo.getScheduleId());
|
||||
lqw.eq("opss.del_flag", 0);
|
||||
lqw.eq(bo.getStepOrder() != null, "opss.step_order", bo.getStepOrder());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getStepName()), "opss.step_name", bo.getStepName());
|
||||
lqw.eq(bo.getStatus() != null, "opss.status", bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目进度步骤跟踪
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OaProjectScheduleStepBo bo) {
|
||||
OaProjectScheduleStep add = BeanUtil.toBean(bo, OaProjectScheduleStep.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setTrackId(add.getTrackId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目进度步骤跟踪
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OaProjectScheduleStepBo bo) {
|
||||
OaProjectScheduleStep update = BeanUtil.toBean(bo, OaProjectScheduleStep.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OaProjectScheduleStep entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除项目进度步骤跟踪
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OaProjectScheduleStepVo maxStepByScheduleId(Long scheduleId) {
|
||||
return baseMapper.maxStepByScheduleId(scheduleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByStepAndScheduleId(Long currentStep, Long scheduleId) {
|
||||
|
||||
baseMapper.updateByStepAndScheduleId(currentStep,scheduleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OaProjectScheduleStepVo selectByCurrentStepAndScheduleId(Long currentStep, Long scheduleId) {
|
||||
return baseMapper.selectByCurrentStepAndScheduleId(currentStep,scheduleId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.OaScheduleTemplateBo;
|
||||
import com.ruoyi.oa.domain.vo.OaScheduleTemplateVo;
|
||||
import com.ruoyi.oa.domain.OaScheduleTemplate;
|
||||
import com.ruoyi.oa.mapper.OaScheduleTemplateMapper;
|
||||
import com.ruoyi.oa.service.IOaScheduleTemplateService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 进度模板主Service业务层处理
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OaScheduleTemplateServiceImpl implements IOaScheduleTemplateService {
|
||||
|
||||
private final OaScheduleTemplateMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询进度模板主
|
||||
*/
|
||||
@Override
|
||||
public OaScheduleTemplateVo queryById(Long templateId){
|
||||
return baseMapper.selectVoById(templateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询进度模板主列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaScheduleTemplateVo> queryPageList(OaScheduleTemplateBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OaScheduleTemplate> lqw = buildQueryWrapper(bo);
|
||||
Page<OaScheduleTemplateVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询进度模板主列表
|
||||
*/
|
||||
@Override
|
||||
public List<OaScheduleTemplateVo> queryList(OaScheduleTemplateBo bo) {
|
||||
LambdaQueryWrapper<OaScheduleTemplate> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OaScheduleTemplate> buildQueryWrapper(OaScheduleTemplateBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OaScheduleTemplate> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getTemplateName()), OaScheduleTemplate::getTemplateName, bo.getTemplateName());
|
||||
lqw.eq(bo.getStatus() != null, OaScheduleTemplate::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增进度模板主
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OaScheduleTemplateBo bo) {
|
||||
OaScheduleTemplate add = BeanUtil.toBean(bo, OaScheduleTemplate.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setTemplateId(add.getTemplateId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改进度模板主
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OaScheduleTemplateBo bo) {
|
||||
OaScheduleTemplate update = BeanUtil.toBean(bo, OaScheduleTemplate.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OaScheduleTemplate entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除进度模板主
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.OaScheduleTemplateStepBo;
|
||||
import com.ruoyi.oa.domain.vo.OaScheduleTemplateStepVo;
|
||||
import com.ruoyi.oa.domain.OaScheduleTemplateStep;
|
||||
import com.ruoyi.oa.mapper.OaScheduleTemplateStepMapper;
|
||||
import com.ruoyi.oa.service.IOaScheduleTemplateStepService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 进度模板步骤Service业务层处理
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OaScheduleTemplateStepServiceImpl implements IOaScheduleTemplateStepService {
|
||||
|
||||
private final OaScheduleTemplateStepMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询进度模板步骤
|
||||
*/
|
||||
@Override
|
||||
public OaScheduleTemplateStepVo queryById(Long stepId){
|
||||
return baseMapper.selectVoById(stepId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询进度模板步骤列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaScheduleTemplateStepVo> queryPageList(OaScheduleTemplateStepBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<OaScheduleTemplateStep> lqw = buildQueryWrapper(bo);
|
||||
Page<OaScheduleTemplateStepVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询进度模板步骤列表
|
||||
*/
|
||||
@Override
|
||||
public List<OaScheduleTemplateStepVo> queryList(OaScheduleTemplateStepBo bo) {
|
||||
QueryWrapper<OaScheduleTemplateStep> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private QueryWrapper<OaScheduleTemplateStep> buildQueryWrapper(OaScheduleTemplateStepBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
QueryWrapper<OaScheduleTemplateStep> lqw = Wrappers.query();
|
||||
|
||||
lqw.eq(bo.getTemplateId() != null, "template_id", bo.getTemplateId());
|
||||
|
||||
lqw.eq(bo.getStepOrder() != null, "step_order", bo.getStepOrder());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getStepName()), "step_name", bo.getStepName());
|
||||
lqw.eq(bo.getExpectedDays() != null,"expected_days", bo.getExpectedDays());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getHeader()), "header", bo.getHeader());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), "description", bo.getDescription());
|
||||
lqw.groupBy("step_name","header","step_id");
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增进度模板步骤
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OaScheduleTemplateStepBo bo) {
|
||||
OaScheduleTemplateStep add = BeanUtil.toBean(bo, OaScheduleTemplateStep.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setStepId(add.getStepId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改进度模板步骤
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OaScheduleTemplateStepBo bo) {
|
||||
OaScheduleTemplateStep update = BeanUtil.toBean(bo, OaScheduleTemplateStep.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OaScheduleTemplateStep entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除进度模板步骤
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,8 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
|
||||
LambdaQueryWrapper<SysOaProject> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), SysOaProject::getProjectName, bo.getProjectName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getProjectNum()), SysOaProject::getProjectNum, bo.getProjectNum());
|
||||
lqw.eq(bo.getTradeType() != null, SysOaProject::getTradeType, bo.getTradeType());
|
||||
lqw.gt(bo.getPrePay()!=null&&bo.getPrePay()>0, SysOaProject::getPrePay,0);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getProjectType()), SysOaProject::getProjectType, bo.getProjectType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getProjectStatus()), SysOaProject::getProjectStatus, bo.getProjectStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCreateBy()), SysOaProject::getCreateBy, bo.getCreateBy());
|
||||
|
||||
Reference in New Issue
Block a user