新增文件预览列表修复了任务显示ossId但是无法现在的情况

新增项目编号索引
This commit is contained in:
2025-05-20 09:11:45 +08:00
parent a0bc26ef3a
commit 1715aa3639
32 changed files with 592 additions and 175 deletions

View File

@@ -0,0 +1,22 @@
package com.ruoyi.oa.controller;
import com.ruoyi.oa.service.CodeGeneratorService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@RequestMapping("/code")
public class CodeGeneratorController {
private final CodeGeneratorService gen;
@GetMapping("/code/{prefix}")
public String genCode(@PathVariable String prefix) {
return gen.nextCode(prefix);
}
}

View File

@@ -43,6 +43,9 @@ public class SysOaProjectController extends BaseController {
private final SysOaTaskMapper sysOaTaskMapper;
/**
* 查询项目管理列表
*/
@@ -51,6 +54,15 @@ public class SysOaProjectController extends BaseController {
return iSysOaProjectService.queryPageList(bo, pageQuery);
}
/**
* 查询项目管理列表
*/
@GetMapping("/ware-list")
public TableDataInfo<SysOaProjectVo> listWareProject(SysOaProjectBo bo, PageQuery pageQuery) {
return iSysOaProjectService.listWareProject(bo, pageQuery);
}
/**
* 导出项目管理列表
*/

View File

@@ -0,0 +1,17 @@
package com.ruoyi.oa.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("sys_prefix_counter")
public class PrefixCounter {
@TableId(value = "prefix", type = IdType.INPUT)
private String prefix; // 主键,用作前缀
private Long seq; // 当前序号
}

View File

@@ -144,4 +144,9 @@ public class SysOaProject extends BaseEntity {
* 预付款
*/
private Double prePay;
/**
* 代号类型
*/
private String projectCode;
}

View File

@@ -176,5 +176,10 @@ public class SysOaProjectBo extends BaseEntity {
* 预付款
*/
private Double prePay;
/**
* 代号类型
*/
private String projectCode;
}

View File

@@ -87,4 +87,6 @@ public class OaProjectScheduleVo {
private String description;
private String projectCode;
}

View File

@@ -7,9 +7,10 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.system.domain.SysOss;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
@@ -137,5 +138,5 @@ public class SysOaContractVo {
@ExcelProperty(value = "备注")
private String remark;
private List<SysOss> fileList;
}

View File

@@ -10,6 +10,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.oa.domain.SysOaTask;
import com.ruoyi.system.domain.SysOss;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -239,4 +240,11 @@ public class SysOaProjectVo {
* 预付款
*/
private Double prePay;
private List<SysOss> fileList;
/**
* 代号类型
*/
private String projectCode;
}

View File

@@ -6,11 +6,12 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.system.domain.SysOss;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
@@ -110,4 +111,6 @@ public class SysOaTaskItemVo {
private String nickName;
}
private List<SysOss> itemFileList;
}

View File

@@ -7,6 +7,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.SysOss;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@@ -210,4 +211,6 @@ public class SysOaTaskVo {
private List<SysOaTaskItemVo> taskItemVoList;
private String files;
private List<SysOss> fileList;
}

View File

@@ -67,5 +67,6 @@ public class SysOaWarehouseDetailVo extends BaseEntity {
private String model;
private String specifications;
private String brand;
}

View File

@@ -0,0 +1,22 @@
package com.ruoyi.oa.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.oa.domain.PrefixCounter;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
public interface PrefixCounterMapper extends BaseMapper<PrefixCounter> {
/**
* 若首次使用该 prefix ⇒ 插入 seq = 1
* 否则 ⇒ seq 原子 +1并把新值写进 LAST_INSERT_ID
*/
void upsertAndIncr(@Param("prefix") String prefix);
/** 取上一步 LAST_INSERT_ID()(就是它自增后的新序号) */
@Select("SELECT LAST_INSERT_ID()")
Long getLastSeq();
}

View File

@@ -1,9 +1,14 @@
package com.ruoyi.oa.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ruoyi.oa.domain.SysOaContract;
import com.ruoyi.oa.domain.vo.SysOaContractVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 合同管理Mapper接口
@@ -14,4 +19,8 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysOaContractMapper extends BaseMapperPlus<SysOaContractMapper, SysOaContract, SysOaContractVo> {
SysOaContractVo selectVoOnePlus(@Param(Constants.WRAPPER) QueryWrapper<SysOaContract> sysOaContractLambdaQueryWrapper);
List<SysOaContractVo> selectVoListPlus(@Param(Constants.WRAPPER)QueryWrapper<SysOaContract> sysOaContractLambdaQueryWrapper);
}

View File

@@ -51,4 +51,10 @@ public interface SysOaProjectMapper extends BaseMapperPlus<SysOaProjectMapper, S
* @return
*/
Page<SysOaProjectVo> selectVoListPage(@Param("page") Page<SysOaProjectVo> build,@Param(Constants.WRAPPER) QueryWrapper<SysOaProject> bo);
Page<SysOaProjectVo> listWareProject(@Param("page") Page<SysOaProjectVo> build,@Param(Constants.WRAPPER) QueryWrapper<SysOaProject> bo);
SysOaProjectVo selectVoByIdPlus(Long projectId);
}

View File

@@ -0,0 +1,6 @@
package com.ruoyi.oa.service;
public interface CodeGeneratorService {
String nextCode(String prefix) ;
}

View File

@@ -76,4 +76,6 @@ public interface ISysOaProjectService {
TableDataInfo<SysOaProjectVo> queryPageList2(SysOaProjectBo bo, PageQuery pageQuery);
TableDataInfo<SysOaProjectVo> listProjects(SysOaProjectBo bo, PageQuery pageQuery);
TableDataInfo<SysOaProjectVo> listWareProject(SysOaProjectBo bo, PageQuery pageQuery);
}

View File

@@ -0,0 +1,26 @@
package com.ruoyi.oa.service.impl;
import com.ruoyi.oa.mapper.PrefixCounterMapper;
import com.ruoyi.oa.service.CodeGeneratorService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@RequiredArgsConstructor
@Service
public class CodeGeneratorServiceImpl implements CodeGeneratorService {
@Autowired
private PrefixCounterMapper mapper;
@Transactional(rollbackFor = Exception.class)
@Override
public String nextCode(String prefix) {
mapper.upsertAndIncr(prefix); // 原子插/更
long num = mapper.getLastSeq(); // 拿到新的序号
// 改动在这里:%07d 表示数字宽度 7不足的前面补 0
String padded = String.format("%07d", num);
return prefix + "-" + padded; // e.g. TH-0000001
}
}

View File

@@ -10,9 +10,12 @@ 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.OaScheduleTemplateStep;
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.domain.vo.OaScheduleTemplateStepVo;
import com.ruoyi.oa.domain.vo.OaScheduleTemplateVo;
import com.ruoyi.oa.mapper.OaScheduleTemplateMapper;
import com.ruoyi.oa.service.IOaProjectScheduleStepService;
import com.ruoyi.oa.service.IOaScheduleTemplateStepService;
@@ -111,6 +114,7 @@ public class OaProjectScheduleServiceImpl implements IOaProjectScheduleService {
}
bo.setTemplateId(templateId);
}
bo.setCurrentStep(1L);
OaProjectSchedule add = BeanUtil.toBean(bo, OaProjectSchedule.class);
validEntityBeforeSave(add);
@@ -118,13 +122,19 @@ public class OaProjectScheduleServiceImpl implements IOaProjectScheduleService {
if (flag) {
bo.setScheduleId(add.getScheduleId());
}
Long templateId = bo.getTemplateId();
OaScheduleTemplateStepBo oaScheduleTemplateStep = new OaScheduleTemplateStepBo();
oaScheduleTemplateStep.setTemplateId(templateId);
List<OaScheduleTemplateStepVo> oaScheduleTemplateStepVos = scheduleTemplateStepService.queryList(oaScheduleTemplateStep);
for (int i = 0; i < bo.getSteps().size(); i++) {
OaProjectScheduleStepBo step = bo.getSteps().get(i);
step.setScheduleId(add.getScheduleId());
step.setStepOrder((long) (i+1));
OaScheduleTemplateStepVo oaScheduleTemplateStepVo = oaScheduleTemplateStepVos.get(i);
step.setStepOrder(oaScheduleTemplateStepVo.getStepOrder());
step.setBatchId(1L);
step.setHeader(oaScheduleTemplateStepVo.getHeader());
if (i==0){
step.setActualStart(new Date());
}

View File

@@ -45,7 +45,7 @@ public class OaScheduleTemplateStepServiceImpl implements IOaScheduleTemplateSte
*/
@Override
public TableDataInfo<OaScheduleTemplateStepVo> queryPageList(OaScheduleTemplateStepBo bo, PageQuery pageQuery) {
QueryWrapper<OaScheduleTemplateStep> lqw = buildQueryWrapper(bo);
QueryWrapper<OaScheduleTemplateStep> lqw = buildQueryWrapperSelect(bo);
Page<OaScheduleTemplateStepVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@@ -62,6 +62,19 @@ public class OaScheduleTemplateStepServiceImpl implements IOaScheduleTemplateSte
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.orderByAsc("step_order");
return lqw;
}
private QueryWrapper<OaScheduleTemplateStep> buildQueryWrapperSelect(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());

View File

@@ -1,6 +1,7 @@
package com.ruoyi.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -70,8 +71,9 @@ public class SysOaContractServiceImpl implements ISysOaContractService {
*/
@Override
public SysOaContractVo findContractByProjectId(SysOaContractBo bo){
LambdaQueryWrapper<SysOaContract> sysOaContractLambdaQueryWrapper = buildContractWrapper(bo);
return contractMapper.selectVoOne(sysOaContractLambdaQueryWrapper);
QueryWrapper<SysOaContract> sysOaContractLambdaQueryWrapper = buildContractWrapper(bo);
return contractMapper.selectVoOnePlus(sysOaContractLambdaQueryWrapper);
}
/**
@@ -81,8 +83,8 @@ public class SysOaContractServiceImpl implements ISysOaContractService {
*/
@Override
public List<SysOaContractVo> selectContractByProjectId(SysOaContractBo bo){
LambdaQueryWrapper<SysOaContract> sysOaContractLambdaQueryWrapper = buildContractWrapper(bo); ;
return contractMapper.selectVoList(sysOaContractLambdaQueryWrapper);
QueryWrapper<SysOaContract> sysOaContractLambdaQueryWrapper = buildContractWrapper(bo); ;
return contractMapper.selectVoListPlus(sysOaContractLambdaQueryWrapper);
}
private LambdaQueryWrapper<SysOaContract> buildQueryWrapper(SysOaContractBo bo) {
@@ -97,10 +99,10 @@ public class SysOaContractServiceImpl implements ISysOaContractService {
return lqw;
}
private LambdaQueryWrapper<SysOaContract> buildContractWrapper(SysOaContractBo bo) {
LambdaQueryWrapper<SysOaContract> lqw = Wrappers.lambdaQuery();
lqw.eq(SysOaContract::getProjectId, bo.getProjectId());
lqw.eq(SysOaContract::getContractType, bo.getContractType());
private QueryWrapper<SysOaContract> buildContractWrapper(SysOaContractBo bo) {
QueryWrapper<SysOaContract> lqw = Wrappers.query();
lqw.eq("soc.project_id", bo.getProjectId());
lqw.eq("soc.contract_type", bo.getContractType());
return lqw;
}

View File

@@ -12,7 +12,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.oa.domain.bo.SysOaWarehouseDetailBo;
import com.ruoyi.oa.domain.vo.SysOaOutWarehouseListVo;
import com.ruoyi.oa.domain.vo.SysOaTaskVo;
import com.ruoyi.oa.service.CodeGeneratorService;
import liquibase.pro.packaged.A;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.oa.domain.bo.SysOaProjectBo;
import com.ruoyi.oa.domain.vo.SysOaProjectVo;
@@ -35,12 +38,22 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
private final SysOaProjectMapper baseMapper;
@Autowired
private CodeGeneratorService codeGeneratorService;
// 1. 定义常量列表(最好放到某个常量类里)
private static final Set<String> VALID_PREFIXES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"PL", "TC", "GI", "GL", "ZAM", "CC", "CR", "STL", "SM", "TH","RJ"
)));
/**
* 查询项目管理
*/
@Override
public SysOaProjectVo queryById(Long projectId) {
return baseMapper.selectVoById(projectId);
return baseMapper.selectVoByIdPlus(projectId);
}
/**
@@ -67,6 +80,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.like(StringUtils.isNotBlank(bo.getProjectCode()), SysOaProject::getProjectCode, bo.getProjectCode());
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());
@@ -83,6 +98,9 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
*/
@Override
public Boolean insertByBo(SysOaProjectBo bo) {
if (bo.getProjectCode()!=null){
bo.setProjectCode(codeGeneratorService.nextCode(bo.getProjectCode()));
}
SysOaProject add = BeanUtil.toBean(bo, SysOaProject.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
@@ -97,11 +115,17 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
*/
@Override
public Boolean updateByBo(SysOaProjectBo bo) {
String prefix = bo.getProjectCode();
if (prefix != null && VALID_PREFIXES.contains(prefix)) {
// 只有当前缀在上面列表里,才真正去生成新编号
bo.setProjectCode(codeGeneratorService.nextCode(prefix));
}
SysOaProject update = BeanUtil.toBean(bo, SysOaProject.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
// 2. 在你的逻辑里做判断
/**
* 保存前的数据校验
*/
@@ -242,12 +266,26 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
return TableDataInfo.build(result);
}
/**
* 查看存在出库的项目
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<SysOaProjectVo> listWareProject(SysOaProjectBo bo, PageQuery pageQuery) {
QueryWrapper<SysOaProject> lqw = Wrappers.query();
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), "sop.projec_name", bo.getProjectName());
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), "sop.projec_name", bo.getProjectName());
Page<SysOaProjectVo> result = baseMapper.listWareProject(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
private QueryWrapper<SysOaProject> buildOutWareQueryWrapper(SysOaWarehouseDetailBo bo) {
QueryWrapper<SysOaProject> lqw = Wrappers.query();
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), "sop.projec_name", bo.getProjectName());
lqw.eq(StringUtils.isNotBlank(bo.getWarehouseName()), "sow.name", bo.getWarehouseName());
lqw.orderByDesc("sop.create_time");
lqw.orderByDesc("sowm.create_time");
return lqw;
}

View File

@@ -164,22 +164,6 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService {
boolean flag = false;
for (Long workerId : workerIdList) {
if(Objects.nonNull(bo.getAccessory())){
List<String> fileUrls = Arrays.stream(bo.getAccessory().split(","))
.map(String::valueOf)
.collect(Collectors.toList());
String fileIds = ossService.insertFiles(fileUrls);
bo.setAccessory(fileIds);
}
if (Objects.nonNull(bo.getFiles())) {
List<String> fileUrls = Arrays.stream(bo.getFiles().split(","))
.map(String::valueOf)
.collect(Collectors.toList());
String fileIds = ossService.insertFiles(fileUrls);
bo.setFiles(fileIds);
}
SysOaTask add = BeanUtil.toBean(bo, SysOaTask.class);
add.setCreateUserId(LoginHelper.getUserId());
validEntityBeforeSave(add);