feat: 首页添加签单率;告警提醒给项目的负责人等
This commit is contained in:
@@ -26,4 +26,7 @@ public class DashboardRespVO {
|
||||
|
||||
@Schema(description = "合同数量")
|
||||
private Long contractCount;
|
||||
|
||||
@Schema(description = "签单率")
|
||||
private Long signingRate;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -63,6 +65,8 @@ public class CustomerServiceImpl implements CustomerService {
|
||||
dashboardRespVO.setLicenseCount(licenseCount);
|
||||
dashboardRespVO.setContractCount(contractCount);
|
||||
dashboardRespVO.setUserCount(customerMapper.selectUserCount());
|
||||
dashboardRespVO.setSigningRate(BigDecimal.valueOf(contractCount).multiply(BigDecimal.valueOf(100))
|
||||
.divide(BigDecimal.valueOf(projectCount), 0, RoundingMode.HALF_UP).longValue());
|
||||
|
||||
return dashboardRespVO;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.agt.module.license.dal.dataobject.alert.AlertDO;
|
||||
import org.agt.module.license.dal.dataobject.license.LicenseDO;
|
||||
import org.agt.module.license.dal.dataobject.project.ProjectDO;
|
||||
import org.agt.module.license.dal.mysql.alert.AlertMapper;
|
||||
import org.agt.module.license.dal.mysql.license.LicenseMapper;
|
||||
import org.agt.module.license.dal.mysql.project.ProjectMapper;
|
||||
import org.agt.module.license.enums.LicenseStatusEnum;
|
||||
import org.agt.module.system.api.mail.MailSendApi;
|
||||
import org.agt.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
|
||||
@@ -19,9 +21,11 @@ import org.springframework.stereotype.Component;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description: License 定时任务
|
||||
@@ -41,6 +45,9 @@ public class LicenseTask {
|
||||
@Resource
|
||||
private LicenseMapper licenseMapper;
|
||||
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Resource
|
||||
private MailSendApi mailSendApi;
|
||||
|
||||
@@ -61,7 +68,6 @@ public class LicenseTask {
|
||||
AlertDO alertDO = alertOptional.get();
|
||||
|
||||
List<Integer> days = alertDO.getDays();
|
||||
List<Long> users = alertDO.getUsers();
|
||||
String templateCode = alertDO.getTemplateCode();
|
||||
|
||||
List<LicenseDO> licenseList = licenseMapper.selectList(Wrappers.<LicenseDO>lambdaQuery()
|
||||
@@ -69,6 +75,18 @@ public class LicenseTask {
|
||||
.gt(LicenseDO::getExpiryDate, LocalDateTime.now()));
|
||||
|
||||
for (LicenseDO licenseDO : licenseList) {
|
||||
|
||||
ProjectDO projectDO = projectMapper.selectById(licenseDO.getProjectId());
|
||||
Set<Long> users = new HashSet<>();
|
||||
if (projectDO.getBusinessOwner() != null) {
|
||||
users.add(projectDO.getBusinessOwner());
|
||||
}
|
||||
if (projectDO.getTechnicalOwnerA() != null) {
|
||||
users.add(projectDO.getTechnicalOwnerA());
|
||||
}
|
||||
if (licenseDO.getApprover() != null) {
|
||||
users.add(licenseDO.getApprover());
|
||||
}
|
||||
for (Integer day : days) {
|
||||
long between = LocalDateTimeUtil.between(LocalDateTime.now(), licenseDO.getExpiryDate(), ChronoUnit.DAYS) + 1;
|
||||
if (between == day) {
|
||||
|
||||
Reference in New Issue
Block a user