feat: lic文件名取提供的;合同数等

This commit is contained in:
caiyuchao
2025-08-13 10:23:06 +08:00
parent 706b125d18
commit d7cb6664f5
6 changed files with 60 additions and 26 deletions

View File

@@ -24,6 +24,18 @@ public class CommentTreeRespVO {
@Schema(description = "项目名称", example = "18334")
private String projectName;
@Schema(description = "项目状态", example = "18334")
private Integer status;
@Schema(description = "serialNo", example = "随便")
private String serialNo;
@Schema(description = "业务负责人")
private String businessOwner;
@Schema(description = "技术负责人1")
private String technicalOwnerA;
@Schema(description = "用户ID", example = "30248")
@ExcelProperty("用户ID")
private Long userId;

View File

@@ -23,4 +23,7 @@ public class DashboardRespVO {
@Schema(description = "用户数量")
private Long userCount;
@Schema(description = "合同数量")
private Long contractCount;
}

View File

@@ -5,6 +5,7 @@ import org.agt.framework.mybatis.core.mapper.BaseMapperX;
import org.agt.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.agt.module.license.controller.admin.license.vo.LicensePageReqVO;
import org.agt.module.license.dal.dataobject.license.LicenseDO;
import org.agt.module.license.enums.LicenseStatusEnum;
import org.apache.ibatis.annotations.Mapper;
import java.time.LocalDateTime;
@@ -37,8 +38,9 @@ public interface LicenseMapper extends BaseMapperX<LicenseDO> {
default List<LicenseDO> selectListByExpiryDate() {
return selectList(new LambdaQueryWrapperX<LicenseDO>()
.gt(LicenseDO::getExpiryDate, LocalDateTime.now())
.last("limit 10")
.orderByDesc(LicenseDO::getApplicationTime));
.le(LicenseDO::getExpiryDate, LocalDateTime.now().plusDays(8))
.eq(LicenseDO::getStatus, LicenseStatusEnum.COMPLETED.getCode())
.orderByAsc(LicenseDO::getExpiryDate));
}
default LicenseDO selectBySn(String sn) {

View File

@@ -2,6 +2,7 @@ package org.agt.module.license.service.customer;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource;
import org.agt.framework.common.pojo.PageResult;
import org.agt.framework.common.util.object.BeanUtils;
@@ -12,6 +13,7 @@ import org.agt.module.license.controller.admin.customer.vo.CustomerSaveReqVO;
import org.agt.module.license.controller.admin.customer.vo.DashboardRespVO;
import org.agt.module.license.controller.admin.license.vo.ImportRespVO;
import org.agt.module.license.dal.dataobject.customer.CustomerDO;
import org.agt.module.license.dal.dataobject.project.ProjectDO;
import org.agt.module.license.dal.mysql.customer.CustomerMapper;
import org.agt.module.license.dal.mysql.license.LicenseMapper;
import org.agt.module.license.dal.mysql.project.ProjectMapper;
@@ -53,12 +55,15 @@ public class CustomerServiceImpl implements CustomerService {
public DashboardRespVO dashboard() {
Long customerCount = customerMapper.selectCount();
Long projectCount = projectMapper.selectCount();
Long contractCount = projectMapper.selectCount(Wrappers.<ProjectDO>lambdaQuery().ne(ProjectDO::getContractCode, "0"));
Long licenseCount = licenseMapper.selectCount();
DashboardRespVO dashboardRespVO = new DashboardRespVO();
dashboardRespVO.setCustomerCount(customerCount);
dashboardRespVO.setProjectCount(projectCount);
dashboardRespVO.setLicenseCount(licenseCount);
dashboardRespVO.setContractCount(contractCount);
dashboardRespVO.setUserCount(customerMapper.selectUserCount());
return dashboardRespVO;
}

View File

@@ -132,6 +132,7 @@ public class LicenseServiceImpl implements LicenseService {
List<LicenseDetailDO> licenseDetails = BeanUtils.toBean(neCodeList, LicenseDetailDO.class);
for (LicenseDetailDO licenseDetail : licenseDetails) {
licenseDetail.setId(null);
licenseDetail.setLicenseId(license.getId());
}
licenseDetailMapper.insertBatch(licenseDetails);
@@ -245,6 +246,7 @@ public class LicenseServiceImpl implements LicenseService {
licenseDetailMapper.delete(Wrappers.<LicenseDetailDO>lambdaQuery().eq(LicenseDetailDO::getLicenseId, licenseDO.getId()));
for (LicenseDetailVO neCode : updateReqVO.getNeCodeList()) {
neCode.setId(null);
neCode.setFileUrlLegacy(null);
neCode.setFileUrl(null);
neCode.setProviderId(null);
@@ -306,6 +308,7 @@ public class LicenseServiceImpl implements LicenseService {
try {
log.info("下载License文件路径为{}", newFilePath1);
fileContent = FileUtil.readBytes(newFilePath1);
fileName = FileUtil.getName(newFilePath1);
} catch (Exception e) {
log.error("读取文件失败", e);
}
@@ -314,11 +317,11 @@ public class LicenseServiceImpl implements LicenseService {
// fileContent = ResourceUtil.readBytes("file/MME_13750602_2024-08-02_system.ini");
} else {
// 上传到文件服务
String preFileName = "45G_";
if (newFilePath1.contains("Legacy_")) {
preFileName = "Legacy_";
}
String fileURL = fileApi.createFile(fileContent, preFileName + fileName);
// String preFileName = "45G_";
// if (newFilePath1.contains("Legacy_")) {
// preFileName = "Legacy_";
// }
String fileURL = fileApi.createFile(fileContent, fileName);
fileUrls.add(fileURL);
}
@@ -330,6 +333,7 @@ public class LicenseServiceImpl implements LicenseService {
try {
log.info("下载Legacy_License文件路径为{}", newFilePath0);
fileContent0 = FileUtil.readBytes(newFilePath0);
fileName = FileUtil.getName(newFilePath0);
} catch (Exception e) {
log.error("读取文件失败", e);
}
@@ -338,11 +342,11 @@ public class LicenseServiceImpl implements LicenseService {
// fileContent0 = ResourceUtil.readBytes("file/MME_13750602_2024-08-02_system.ini");
} else {
// 上传到文件服务
String preFileName = "45G_";
if (newFilePath0.contains("Legacy_")) {
preFileName = "Legacy_";
}
String fileURL = fileApi.createFile(fileContent0, preFileName + fileName);
// String preFileName = "45G_";
// if (newFilePath0.contains("Legacy_")) {
// preFileName = "Legacy_";
// }
String fileURL = fileApi.createFile(fileContent0, fileName);
fileUrls.add(fileURL);
}
@@ -373,19 +377,21 @@ public class LicenseServiceImpl implements LicenseService {
LicenseProviderDO licenseProviderDO = licenseProviderMapper.selectById(detail.getProviderId());
String fileName = getFileName(licenseDO.getSerialNo(), detail.getNeList());
if (StrUtil.isNotBlank(licenseProviderDO.getNewFilePath1())) {
String preFileName = "45G_";
if (licenseProviderDO.getNewFilePath1().contains("Legacy_")) {
preFileName = "Legacy_";
}
pathList.add(preFileName + fileName);
// String preFileName = "45G_";
// if (licenseProviderDO.getNewFilePath1().contains("Legacy_")) {
// preFileName = "Legacy_";
// }
fileName = FileUtil.getName(licenseProviderDO.getNewFilePath1());
pathList.add(fileName);
inputStreamList.add(new ByteArrayInputStream(FileUtil.readBytes(licenseProviderDO.getNewFilePath1())));
}
if (StrUtil.isNotBlank(licenseProviderDO.getNewFilePath0())) {
String preFileName = "45G_";
if (licenseProviderDO.getNewFilePath0().contains("Legacy_")) {
preFileName = "Legacy_";
}
pathList.add(preFileName + fileName);
// String preFileName = "45G_";
// if (licenseProviderDO.getNewFilePath0().contains("Legacy_")) {
// preFileName = "Legacy_";
// }
fileName = FileUtil.getName(licenseProviderDO.getNewFilePath0());
pathList.add(fileName);
inputStreamList.add(new ByteArrayInputStream(FileUtil.readBytes(licenseProviderDO.getNewFilePath0())));
}
@@ -556,9 +562,9 @@ public class LicenseServiceImpl implements LicenseService {
public PageResult<LicenseRespVO> getLicensePage(LicensePageReqVO pageReqVO) {
PageResult<LicenseDO> pageResult = licenseMapper.selectPage(pageReqVO);
PageResult<LicenseRespVO> voPageResult = BeanUtils.toBean(pageResult, LicenseRespVO.class);
// for (LicenseRespVO licenseRespVO : voPageResult.getList()) {
// fillLicenseRespVO(licenseRespVO);
// }
for (LicenseRespVO licenseRespVO : voPageResult.getList()) {
fillLicenseRespVO(licenseRespVO);
}
return voPageResult;
}

View File

@@ -29,7 +29,11 @@
c.*,
u.nickname author,
u.avatar,
p.`name` project_name
p.`name` project_name,
p.status,
p.business_owner,
p.technical_owner_a,
CONCAT( cu.`code`, p.`code` ) serial_no
FROM
(
SELECT
@@ -51,6 +55,8 @@
AND u.deleted = 0
LEFT JOIN crm_project p ON c.project_id = p.id
AND p.deleted = 0
LEFT JOIN crm_customer cu ON p.customer_id = cu.id
AND cu.deleted = 0
ORDER BY
c.update_time DESC
LIMIT 10