feat: 项目管理字段调整

This commit is contained in:
caiyuchao
2025-08-15 15:58:58 +08:00
parent 8ea207fc0d
commit 3e2a824f8e
12 changed files with 157 additions and 72 deletions

View File

@@ -109,7 +109,7 @@ public class ProjectController {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ProjectRespVO> list = projectService.getProjectPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "项目.xlsx", "数据", ProjectRespVO.class,
ExcelUtils.write(response, "项目.xlsx", "项目列表", ProjectRespVO.class,
TranslateUtils.translate(list));
}
@@ -139,16 +139,16 @@ public class ProjectController {
// 手动创建导出 demo
List<ProjectImportRespVO> list = Arrays.asList(
ProjectImportRespVO.builder().name("测试项目").serialNo("20002000").startTime(LocalDateTime.now())
.contractCode("111111").status(1).businessOwner("小明").technicalOwnerA("小张")
.businessStatus(1).customerOwner("小丽").envInfo("测试环境")
.contractCode("111111").status(1).businessOwner(143L).technicalOwnerA(143L)
.businessStatus(1).customerOwner("小丽").envInfo(1).softwareVersion(1).operatingSystem(1)
.build(),
ProjectImportRespVO.builder().name("测试项目2").serialNo("20002001").startTime(LocalDateTime.now())
.contractCode("222222").status(1).businessOwner("小明").technicalOwnerA("小张")
.businessStatus(1).customerOwner("小丽").envInfo("测试环境")
.contractCode("222222").status(1).businessOwner(143L).technicalOwnerA(143L)
.businessStatus(1).customerOwner("小丽").envInfo(2).softwareVersion(2).operatingSystem(2)
.build()
);
// 输出
ExcelUtils.write(response, "项目导入模板.xlsx", "项目列表", ProjectImportRespVO.class, list);
ExcelUtils.write(response, "项目导入模板.xlsx", "项目列表", ProjectImportRespVO.class, TranslateUtils.translate(list));
}
@PostMapping("/import")

View File

@@ -1,6 +1,9 @@
package org.agt.module.license.controller.admin.project.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.VO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
@@ -10,6 +13,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.agt.framework.excel.core.annotations.DictFormat;
import org.agt.framework.excel.core.convert.DictConvert;
import org.agt.module.system.api.user.AdminUserApi;
import java.time.LocalDateTime;
@@ -18,8 +22,12 @@ import java.time.LocalDateTime;
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false避免导入有问题
@ExcelIgnoreUnannotated
public class ProjectImportRespVO implements VO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25585")
private Long id;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "aa")
@ExcelProperty("项目名称")
private String name;
@@ -42,20 +50,28 @@ public class ProjectImportRespVO implements VO {
private Integer status;
@Schema(description = "业务负责人ID", requiredMode = Schema.RequiredMode.REQUIRED)
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "businessOwnerName")
private Long businessOwner;
@Schema(description = "业务负责人", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("业务负责人")
private String businessOwner;
private String businessOwnerName;
@Schema(description = "技术负责人1ID", requiredMode = Schema.RequiredMode.REQUIRED)
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerAName")
private Long technicalOwnerA;
@Schema(description = "技术负责人1", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("技术负责人1")
private String technicalOwnerA;
private String technicalOwnerAName;
@Schema(description = "技术负责人2ID")
@ExcelProperty("技术负责人2")
private String technicalOwnerB;
private Long technicalOwnerB;
@Schema(description = "技术负责人3ID")
@ExcelProperty("技术负责人3")
private String technicalOwnerC;
private Long technicalOwnerC;
@Schema(description = "商务状态", example = "2")
@ExcelProperty(value = "商务状态", converter = DictConvert.class)
@@ -66,15 +82,22 @@ public class ProjectImportRespVO implements VO {
@ExcelProperty("客户对接人")
private String customerOwner;
@Schema(description = "环境信息")
@ExcelProperty("环境信息")
private String envInfo;
@Schema(description = "项目结束时间")
@ExcelProperty("项目结束时间")
private LocalDateTime endTime;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "环境信息")
@ExcelProperty(value = "环境信息", converter = DictConvert.class)
@DictFormat("lic_env_info")
private Integer envInfo;
@Schema(description = "软件版本信息")
@ExcelProperty(value = "软件版本信息", converter = DictConvert.class)
@DictFormat("lic_software_version")
private Integer softwareVersion;
@Schema(description = "操作系统")
@ExcelProperty(value = "操作系统", converter = DictConvert.class)
@DictFormat("lic_operating_system")
private Integer operatingSystem;
}

View File

@@ -33,19 +33,19 @@ public class ProjectListReqVO extends PageParam {
private Integer businessStatus;
@Schema(description = "业务负责人")
private String businessOwner;
private Long businessOwner;
@Schema(description = "客户对接人")
private String customerOwner;
@Schema(description = "技术负责人1")
private String technicalOwnerA;
private Long technicalOwnerA;
@Schema(description = "技术负责人2")
private String technicalOwnerB;
private Long technicalOwnerB;
@Schema(description = "技术负责人3")
private String technicalOwnerC;
private Long technicalOwnerC;
@Schema(description = "项目开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@@ -59,7 +59,13 @@ public class ProjectListReqVO extends PageParam {
private Integer status;
@Schema(description = "环境信息")
private String envInfo;
private Integer envInfo;
@Schema(description = "软件版本信息")
private Integer softwareVersion;
@Schema(description = "操作系统")
private Integer operatingSystem;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

View File

@@ -30,22 +30,22 @@ public class ProjectPageReqVO extends PageParam {
private Integer businessStatus;
@Schema(description = "业务负责人")
private String businessOwner;
private Long businessOwner;
@Schema(description = "客户对接人")
private String customerOwner;
@Schema(description = "技术负责人")
private String technicalOwner;
private Long technicalOwner;
@Schema(description = "技术负责人1")
private String technicalOwnerA;
private Long technicalOwnerA;
@Schema(description = "技术负责人2")
private String technicalOwnerB;
private Long technicalOwnerB;
@Schema(description = "技术负责人3")
private String technicalOwnerC;
private Long technicalOwnerC;
@Schema(description = "项目开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@@ -59,7 +59,13 @@ public class ProjectPageReqVO extends PageParam {
private Integer status;
@Schema(description = "环境信息")
private String envInfo;
private Integer envInfo;
@Schema(description = "软件版本信息")
private Integer softwareVersion;
@Schema(description = "操作系统")
private Integer operatingSystem;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

View File

@@ -10,6 +10,7 @@ import lombok.Data;
import org.agt.framework.excel.core.annotations.DictFormat;
import org.agt.framework.excel.core.convert.DictConvert;
import org.agt.module.license.dal.dataobject.customer.CustomerDO;
import org.agt.module.system.api.user.AdminUserApi;
import java.time.LocalDateTime;
@@ -56,24 +57,36 @@ public class ProjectRespVO implements VO {
private Integer status;
@Schema(description = "业务负责人ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("业务负责人")
private String businessOwner;
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "businessOwnerName")
private Long businessOwner;
@Schema(description = "技术负责人1ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("技术负责人1")
private String technicalOwnerA;
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerAName")
private Long technicalOwnerA;
@Schema(description = "技术负责人2ID")
@ExcelProperty("技术负责人2")
private String technicalOwnerB;
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerBName")
private Long technicalOwnerB;
@Schema(description = "技术负责人3ID")
@ExcelProperty("技术负责人3")
private String technicalOwnerC;
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerCName")
private Long technicalOwnerC;
@Schema(description = "环境信息")
@ExcelProperty("环境信息")
private String envInfo;
@Schema(description = "业务负责人", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("业务负责人")
private String businessOwnerName;
@Schema(description = "技术负责人1", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("技术负责人1")
private String technicalOwnerAName;
@Schema(description = "技术负责人2")
@ExcelProperty("技术负责人2")
private String technicalOwnerBName;
@Schema(description = "技术负责人3")
@ExcelProperty("技术负责人3")
private String technicalOwnerCName;
@Schema(description = "商务状态", example = "2")
@ExcelProperty(value = "商务状态", converter = DictConvert.class)
@@ -88,8 +101,22 @@ public class ProjectRespVO implements VO {
@ExcelProperty("项目结束时间")
private LocalDateTime endTime;
@Schema(description = "环境信息")
@ExcelProperty(value = "环境信息", converter = DictConvert.class)
@DictFormat("lic_env_info")
private Integer envInfo;
@Schema(description = "软件版本信息")
@ExcelProperty(value = "软件版本信息", converter = DictConvert.class)
@DictFormat("lic_software_version")
private Integer softwareVersion;
@Schema(description = "操作系统")
@ExcelProperty(value = "操作系统", converter = DictConvert.class)
@DictFormat("lic_operating_system")
private Integer operatingSystem;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "评论数")

View File

@@ -35,7 +35,7 @@ public class ProjectSaveReqVO {
@Schema(description = "业务负责人", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "业务负责人不能为空")
private String businessOwner;
private Long businessOwner;
@Schema(description = "客户对接人", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "客户对接人不能为空")
@@ -43,13 +43,13 @@ public class ProjectSaveReqVO {
@Schema(description = "技术负责人1", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "技术负责人1不能为空")
private String technicalOwnerA;
private Long technicalOwnerA;
@Schema(description = "技术负责人2")
private String technicalOwnerB;
private Long technicalOwnerB;
@Schema(description = "技术负责人3")
private String technicalOwnerC;
private Long technicalOwnerC;
@Schema(description = "项目开始时间")
private LocalDateTime startTime;
@@ -62,10 +62,13 @@ public class ProjectSaveReqVO {
private Integer status;
@Schema(description = "环境信息")
private String envInfo;
private Integer envInfo;
@Schema(description = "环境信息附件id", example = "18887")
private Long envFileId;
@Schema(description = "操作系统")
private Integer operatingSystem;
@Schema(description = "软件版本信息")
private Integer softwareVersion;
@Schema(description = "备注", example = "随便")
private String remark;

View File

@@ -58,7 +58,7 @@ public class ProjectDO extends BaseDO {
/**
* 业务负责人
*/
private String businessOwner;
private Long businessOwner;
/**
* 客户对接人
*/
@@ -66,15 +66,15 @@ public class ProjectDO extends BaseDO {
/**
* 技术负责人1
*/
private String technicalOwnerA;
private Long technicalOwnerA;
/**
* 技术负责人2
*/
private String technicalOwnerB;
private Long technicalOwnerB;
/**
* 技术负责人3
*/
private String technicalOwnerC;
private Long technicalOwnerC;
/**
* 项目开始时间
*/
@@ -92,11 +92,15 @@ public class ProjectDO extends BaseDO {
/**
* 环境信息
*/
private String envInfo;
private Integer envInfo;
/**
* 环境信息附件id
* 软件版本信息
*/
private Long envFileId;
private Integer softwareVersion;
/**
* 操作系统
*/
private Integer operatingSystem;
/**
* 备注
*/

View File

@@ -6,6 +6,7 @@ import org.agt.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.agt.module.license.controller.admin.customer.vo.CustomerPageReqVO;
import org.agt.module.license.dal.dataobject.customer.CustomerDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -43,4 +44,6 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
Integer selectMaxCode();
Long selectUserCount();
Long getUserByName(@Param("nickname") String nickname);
}

View File

@@ -1,7 +1,6 @@
package org.agt.module.license.dal.mysql.project;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.agt.framework.common.pojo.PageResult;
import org.agt.framework.mybatis.core.mapper.BaseMapperX;
@@ -36,17 +35,17 @@ public interface ProjectMapper extends BaseMapperX<ProjectDO> {
.likeIfPresent(ProjectDO::getContractCode, reqVO.getContractCode())
.eqIfPresent(ProjectDO::getBusinessStatus, reqVO.getBusinessStatus())
.eqIfPresent(ProjectDO::getBusinessOwner, reqVO.getBusinessOwner())
.eqIfPresent(ProjectDO::getCustomerOwner, reqVO.getCustomerOwner())
.likeIfPresent(ProjectDO::getCustomerOwner, reqVO.getCustomerOwner())
.betweenIfPresent(ProjectDO::getStartTime, reqVO.getStartTime())
.betweenIfPresent(ProjectDO::getEndTime, reqVO.getEndTime())
.eqIfPresent(ProjectDO::getStatus, reqVO.getStatus())
.likeIfPresent(ProjectDO::getEnvInfo, reqVO.getEnvInfo())
.eqIfPresent(ProjectDO::getEnvInfo, reqVO.getEnvInfo())
.betweenIfPresent(ProjectDO::getCreateTime, reqVO.getCreateTime())
.likeIfPresent(LicenseDO::getSerialNo, reqVO.getSerialNo())
.and(StrUtil.isNotBlank(reqVO.getTechnicalOwner()),
c -> c.like(ProjectDO::getTechnicalOwnerA, reqVO.getTechnicalOwner())
.or().like(ProjectDO::getTechnicalOwnerB, reqVO.getTechnicalOwner())
.or().like(ProjectDO::getTechnicalOwnerC, reqVO.getTechnicalOwner()))
.and(reqVO.getTechnicalOwner() != null,
c -> c.eq(ProjectDO::getTechnicalOwnerA, reqVO.getTechnicalOwner())
.or().eq(ProjectDO::getTechnicalOwnerB, reqVO.getTechnicalOwner())
.or().eq(ProjectDO::getTechnicalOwnerC, reqVO.getTechnicalOwner()))
.orderByDesc(ProjectDO::getId));
}
@@ -66,7 +65,7 @@ public interface ProjectMapper extends BaseMapperX<ProjectDO> {
.betweenIfPresent(ProjectDO::getStartTime, reqVO.getStartTime())
.betweenIfPresent(ProjectDO::getEndTime, reqVO.getEndTime())
.eqIfPresent(ProjectDO::getStatus, reqVO.getStatus())
.likeIfPresent(ProjectDO::getEnvInfo, reqVO.getEnvInfo())
.eqIfPresent(ProjectDO::getEnvInfo, reqVO.getEnvInfo())
.betweenIfPresent(ProjectDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ProjectDO::getId));
}

View File

@@ -218,14 +218,16 @@ public class ProjectServiceImpl implements ProjectService {
respVO.getFailures().put(name, "项目状态不能为空");
continue;
}
if (StrUtil.isBlank(importRespVO.getBusinessOwner())) {
if (StrUtil.isBlank(importRespVO.getBusinessOwnerName())) {
respVO.getFailures().put(name, "业务负责人不能为空");
continue;
}
if (StrUtil.isBlank(importRespVO.getTechnicalOwnerA())) {
importRespVO.setBusinessOwner(customerMapper.getUserByName(importRespVO.getBusinessOwnerName()));
if (StrUtil.isBlank(importRespVO.getTechnicalOwnerAName())) {
respVO.getFailures().put(name, "技术负责人1不能为空");
continue;
}
importRespVO.setTechnicalOwnerA(customerMapper.getUserByName(importRespVO.getTechnicalOwnerAName()));
if (importRespVO.getBusinessStatus() == null) {
respVO.getFailures().put(name, "商务状态不能为空");
continue;
@@ -234,10 +236,18 @@ public class ProjectServiceImpl implements ProjectService {
respVO.getFailures().put(name, "客户对接人不能为空");
continue;
}
if (StrUtil.isBlank(importRespVO.getEnvInfo())) {
if (importRespVO.getEnvInfo() == null) {
respVO.getFailures().put(name, "环境信息不能为空");
continue;
}
if (importRespVO.getSoftwareVersion() == null) {
respVO.getFailures().put(name, "软件版本信息不能为空");
continue;
}
if (importRespVO.getOperatingSystem() == null) {
respVO.getFailures().put(name, "操作系统不能为空");
continue;
}
ProjectDO projectDO = BeanUtils.toBean(importRespVO, ProjectDO.class);
projectDO.setCode(projectCode);
projectDO.setCustomerId(customerId);

View File

@@ -7,7 +7,11 @@
</select>
<select id="selectUserCount" resultType="Long">
select count(*) - 1 from system_users WHERE deleted = 0;
select count(*) from system_users WHERE deleted = 0;
</select>
<select id="getUserByName" resultType="Long">
select id from system_users where deleted = 0 and nickname = #{nickname} limit 1;
</select>
</mapper>

View File

@@ -31,8 +31,8 @@
<if test="query.businessStatus != null">
AND p.business_status = #{query.businessStatus}
</if>
<if test="query.businessOwner != null and query.businessOwner != ''">
AND p.business_owner LIKE CONCAT('%',#{query.businessOwner},'%')
<if test="query.businessOwner != null">
AND p.business_owner = #{query.businessOwner}
</if>
<if test="query.customerOwner != null and query.customerOwner != ''">
AND p.customer_owner LIKE CONCAT('%',#{query.customerOwner},'%')
@@ -55,10 +55,10 @@
<if test="query.serialNo != null and query.serialNo != ''">
AND CONCAT( c.`code`, p.`code` ) LIKE CONCAT('%',#{query.serialNo},'%')
</if>
<if test="query.technicalOwner != null and query.technicalOwner != ''">
AND (p.technical_owner_a LIKE CONCAT('%',#{query.technicalOwner},'%')
OR p.technical_owner_b LIKE CONCAT('%',#{query.technicalOwner},'%')
OR p.technical_owner_c LIKE CONCAT('%',#{query.technicalOwner},'%'))
<if test="query.technicalOwner != null">
AND (p.technical_owner_a = #{query.technicalOwner}
OR p.technical_owner_b = #{query.technicalOwner}
OR p.technical_owner_c = #{query.technicalOwner})
</if>
ORDER BY