feat: 项目管理负责人查询
This commit is contained in:
@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.agt.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static org.agt.framework.common.pojo.CommonResult.success;
|
||||
@@ -108,6 +109,14 @@ public class CustomerController {
|
||||
return success(buildCustomerVOList(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得客户分页")
|
||||
@PreAuthorize("@ss.hasPermission('license:customer:query')")
|
||||
public CommonResult<List<CustomerRespVO>> getCustomerList() {
|
||||
List<CustomerDO> listResult = customerService.getCustomerList();
|
||||
return success(BeanUtils.toBean(listResult, CustomerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出客户 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('license:customer:export')")
|
||||
|
||||
@@ -1,33 +1,39 @@
|
||||
package org.agt.module.license.controller.admin.project;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.agt.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import org.agt.framework.common.pojo.CommonResult;
|
||||
import org.agt.framework.common.pojo.PageParam;
|
||||
import org.agt.framework.common.pojo.PageResult;
|
||||
import org.agt.framework.common.pojo.CommonResult;
|
||||
import org.agt.framework.common.util.object.BeanUtils;
|
||||
import static org.agt.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import org.agt.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import org.agt.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static org.agt.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import org.agt.module.license.controller.admin.project.vo.*;
|
||||
import org.agt.framework.translate.core.TranslateUtils;
|
||||
import org.agt.module.license.controller.admin.project.vo.ProjectPageReqVO;
|
||||
import org.agt.module.license.controller.admin.project.vo.ProjectRespVO;
|
||||
import org.agt.module.license.controller.admin.project.vo.ProjectSaveReqVO;
|
||||
import org.agt.module.license.dal.dataobject.project.ProjectDO;
|
||||
import org.agt.module.license.service.project.ProjectService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.agt.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static org.agt.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 项目")
|
||||
@RestController
|
||||
@@ -84,12 +90,12 @@ public class ProjectController {
|
||||
@PreAuthorize("@ss.hasPermission('license:project:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportProjectExcel(@Valid ProjectPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ProjectDO> list = projectService.getProjectPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "项目.xls", "数据", ProjectRespVO.class,
|
||||
BeanUtils.toBean(list, ProjectRespVO.class));
|
||||
TranslateUtils.translate(BeanUtils.toBean(list, ProjectRespVO.class)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,22 +2,35 @@ 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.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;
|
||||
|
||||
@Schema(description = "管理后台 - 项目 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ProjectRespVO {
|
||||
public class ProjectRespVO implements VO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25585")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "客户ID")
|
||||
@Trans(type = TransType.SIMPLE, target = CustomerDO.class, fields = "name", ref = "customerName")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "所属客户")
|
||||
@ExcelProperty("所属客户")
|
||||
private String customerName;
|
||||
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "aa")
|
||||
@ExcelProperty("项目名称")
|
||||
private String name;
|
||||
@@ -35,25 +48,46 @@ public class ProjectRespVO {
|
||||
@DictFormat("lic_business_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer businessStatus;
|
||||
|
||||
@Schema(description = "业务负责人ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "businessOwnerName")
|
||||
private Long businessOwner;
|
||||
|
||||
@Schema(description = "客户对接人ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "customerOwnerName")
|
||||
private Long customerOwner;
|
||||
|
||||
@Schema(description = "技术负责人1ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerAName")
|
||||
private Long technicalOwnerA;
|
||||
|
||||
@Schema(description = "技术负责人2ID")
|
||||
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerBName")
|
||||
private Long technicalOwnerB;
|
||||
|
||||
@Schema(description = "技术负责人3ID")
|
||||
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerCName")
|
||||
private Long technicalOwnerC;
|
||||
|
||||
|
||||
@Schema(description = "业务负责人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("业务负责人")
|
||||
private Long businessOwner;
|
||||
private String businessOwnerName;
|
||||
|
||||
@Schema(description = "客户对接人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("客户对接人")
|
||||
private Long customerOwner;
|
||||
private String customerOwnerName;
|
||||
|
||||
@Schema(description = "技术负责人1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("技术负责人1")
|
||||
private Long technicalOwnerA;
|
||||
private String technicalOwnerAName;
|
||||
|
||||
@Schema(description = "技术负责人2")
|
||||
@ExcelProperty("技术负责人2")
|
||||
private Long technicalOwnerB;
|
||||
private String technicalOwnerBName;
|
||||
|
||||
@Schema(description = "技术负责人3")
|
||||
@ExcelProperty("技术负责人3")
|
||||
private Long technicalOwnerC;
|
||||
private String technicalOwnerCName;
|
||||
|
||||
@Schema(description = "项目开始时间")
|
||||
@ExcelProperty("项目开始时间")
|
||||
|
||||
@@ -7,6 +7,8 @@ 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 java.util.List;
|
||||
|
||||
/**
|
||||
* 客户 Mapper
|
||||
*
|
||||
@@ -26,6 +28,10 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
|
||||
.orderByDesc(CustomerDO::getId));
|
||||
}
|
||||
|
||||
default List<CustomerDO> selectList() {
|
||||
return selectList(new LambdaQueryWrapperX<CustomerDO>().orderByDesc(CustomerDO::getId));
|
||||
}
|
||||
|
||||
default CustomerDO selectByName(String name) {
|
||||
return selectOne(CustomerDO::getName, name);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import org.agt.module.license.controller.admin.customer.vo.CustomerPageReqVO;
|
||||
import org.agt.module.license.controller.admin.customer.vo.CustomerSaveReqVO;
|
||||
import org.agt.module.license.dal.dataobject.customer.CustomerDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户 Service 接口
|
||||
*
|
||||
@@ -51,6 +53,13 @@ public interface CustomerService {
|
||||
*/
|
||||
PageResult<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得客户列表
|
||||
*
|
||||
* @return 客户分页
|
||||
*/
|
||||
List<CustomerDO> getCustomerList();
|
||||
|
||||
/**
|
||||
* 校验客户名称是否唯一
|
||||
*
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.agt.module.license.dal.mysql.customer.CustomerMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.agt.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static org.agt.module.license.enums.ErrorCodeConstants.CUSTOMER_CODE_DUPLICATE;
|
||||
import static org.agt.module.license.enums.ErrorCodeConstants.CUSTOMER_NAME_DUPLICATE;
|
||||
@@ -85,6 +87,11 @@ public class CustomerServiceImpl implements CustomerService {
|
||||
return customerMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomerDO> getCustomerList() {
|
||||
return customerMapper.selectList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean validateCustomerNameUnique(String name, Long id) {
|
||||
if (StrUtil.isBlank(name)) {
|
||||
|
||||
@@ -71,7 +71,7 @@ mybatis-plus:
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
banner: false # 关闭控制台的 Banner 打印
|
||||
type-aliases-package: ${agt.info.base-package}.module.*.dal.dataobject
|
||||
type-aliases-package: ${agt.info.base-package}.dal.dataobject
|
||||
encryptor:
|
||||
password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
|
||||
|
||||
|
||||
Reference in New Issue
Block a user