大屏二级页面
This commit is contained in:
parent
6e29cea504
commit
e4fd3d5dff
|
|
@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
|
|||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
|
@ -35,10 +36,12 @@ public class DevTemplateVo {
|
|||
@ApiModelProperty(value = "设备品牌")
|
||||
private String brand;
|
||||
|
||||
@Excel(name = "出厂日期")
|
||||
|
||||
@ApiModelProperty(value = "出厂日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private String productionDate;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "出厂日期(例:2025-03-17)")
|
||||
private Date productionDate;
|
||||
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@Excel(name = "联系人")
|
||||
|
|
@ -64,13 +67,13 @@ public class DevTemplateVo {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "检修时间(例:2025-03-17)")
|
||||
private String checkDate;
|
||||
private Date checkDate;
|
||||
|
||||
@ApiModelProperty(value = "下次检测日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "下次检测时间(例:2025-03-17)")
|
||||
private String nextCheckDate;
|
||||
private Date nextCheckDate;
|
||||
|
||||
@ApiModelProperty(value = "装备单位")
|
||||
private String unitName;
|
||||
|
|
@ -79,5 +82,5 @@ public class DevTemplateVo {
|
|||
private Float dayLeasePrice;
|
||||
|
||||
@ApiModelProperty(value = "装备证书详情列表")
|
||||
private List<DevTemplateVo> dtoList;
|
||||
private List<DevTemplateVo> tableList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -965,10 +965,10 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
// 根据装备类目查询装备id及价格
|
||||
DevInfoVo devType = devInfoMapper.selectDevTypeByName(devTemplateVo.getTypeName());
|
||||
if (devType != null) {
|
||||
devTemplateVo.setTypeId(Long.valueOf(devType.getId()));
|
||||
devTemplateVo.setTypeName(devType.getTypeName());
|
||||
devTemplateVo.setDayLeasePrice(devType.getDayLeasePrice());
|
||||
devTemplateVo.setUnitName(devType.getUnitName());
|
||||
devTemplateVo.setTypeId(devType.getTypeId() != null ? devType.getTypeId() : null);
|
||||
devTemplateVo.setTypeName(devType.getTypeName() != null ? devType.getTypeName() : null);
|
||||
devTemplateVo.setDayLeasePrice(devType.getDayLeasePrice() != null ? devType.getDayLeasePrice() : null);
|
||||
devTemplateVo.setUnitName(devType.getUnitName() != null ? devType.getUnitName() : null);
|
||||
if ("0".equals(devType.getManageType())) {
|
||||
devTemplateVo.setDeviceCount(1);
|
||||
}
|
||||
|
|
@ -980,16 +980,16 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
for (Map.Entry<String, List<DevTemplateVo>> entry : map.entrySet()) {
|
||||
// 如果map的数量大于1,则进行遍历
|
||||
DevTemplateVo devTemplateVo = entry.getValue().get(0);
|
||||
DevTemplateVo dto = new DevTemplateVo();
|
||||
List<DevTemplateVo> devTemplateVos = entry.getValue();
|
||||
for (DevTemplateVo templateVo : devTemplateVos) {
|
||||
DevTemplateVo dto = new DevTemplateVo();
|
||||
dto.setIdentifyCode(StringUtils.isNotBlank(templateVo.getIdentifyCode()) ? templateVo.getIdentifyCode() : null);
|
||||
dto.setCheckMan(StringUtils.isNotBlank(templateVo.getCheckMan()) ? templateVo.getCheckMan() : null);
|
||||
dto.setCheckDate(StringUtils.isNotBlank(templateVo.getCheckDate()) ? templateVo.getCheckDate() : null);
|
||||
dto.setNextCheckDate(StringUtils.isNotBlank(templateVo.getNextCheckDate()) ? templateVo.getNextCheckDate() : null);
|
||||
dto.setCheckDate(templateVo.getCheckDate() != null ? templateVo.getCheckDate() : null);
|
||||
dto.setNextCheckDate(templateVo.getNextCheckDate() != null ? templateVo.getNextCheckDate() : null);
|
||||
dtoList.add(dto);
|
||||
}
|
||||
devTemplateVo.setDtoList(dtoList);
|
||||
devTemplateVo.setTableList(dtoList);
|
||||
templateVos.add(devTemplateVo);
|
||||
|
||||
}
|
||||
|
|
@ -1023,18 +1023,42 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
case 3:
|
||||
checkDate(cellValue, r, c);
|
||||
break;
|
||||
case 4:
|
||||
checkBlank(cellValue, r, c);
|
||||
case 5:
|
||||
checkPhone(cellValue, r, c);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列超出范围,请检查后重新导入", r + 1, c + 1));
|
||||
case 6:
|
||||
checkNumber(cellValue, r, c);
|
||||
break;
|
||||
case 9:
|
||||
checkDate(cellValue, r, c);
|
||||
break;
|
||||
case 10:
|
||||
checkDate(cellValue, r, c);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查数字格式是否为整数
|
||||
* @param cellValue
|
||||
* @param r
|
||||
* @param c
|
||||
*/
|
||||
private void checkNumber(String cellValue, int r, int c) {
|
||||
if (StringUtils.isNotBlank(cellValue)) {
|
||||
try {
|
||||
Integer.parseInt(cellValue);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列上架数量数据格式错误,请检查后重新导入", r + 1, c + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查日期格式
|
||||
* @param cellValue
|
||||
|
|
@ -1042,16 +1066,31 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
* @param colIndex
|
||||
*/
|
||||
private void checkDate(String cellValue, int rowIndex, int colIndex) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
try {
|
||||
// 尝试解析日期字符串
|
||||
LocalDate.parse(cellValue, formatter);
|
||||
System.out.println(true);
|
||||
} catch (DateTimeParseException e) {
|
||||
// 解析失败,说明日期格式不符合要求
|
||||
if (StringUtils.isBlank(cellValue)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列出厂日期不符合格式要求,请检查后重新导入", rowIndex + 1, colIndex + 1));
|
||||
if (StringUtils.isNotBlank(cellValue)) {
|
||||
// 定义两种日期格式的 DateTimeFormatter
|
||||
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
||||
|
||||
boolean isValid = false;
|
||||
try {
|
||||
// 尝试使用 yyyy-MM-dd 格式解析
|
||||
LocalDate.parse(cellValue, formatter1);
|
||||
isValid = true;
|
||||
} catch (DateTimeParseException e1) {
|
||||
try {
|
||||
// 若第一种格式解析失败,尝试使用 yyyy/MM/dd 格式解析
|
||||
LocalDate.parse(cellValue, formatter2);
|
||||
isValid = true;
|
||||
} catch (DateTimeParseException e2) {
|
||||
// 两种格式都解析失败,抛出异常
|
||||
if (StringUtils.isNotBlank(cellValue)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列时间日期不符合格式要求,请检查后重新导入", rowIndex + 1, colIndex + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isValid) {
|
||||
System.out.println(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1076,9 +1115,11 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
* @param colIndex
|
||||
*/
|
||||
private void checkPhone(String cellValue, int rowIndex, int colIndex) {
|
||||
if (!PhoneUtil.isMobile(cellValue)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列电话号码格式不正确,请检查后重新导入", rowIndex + 1, colIndex + 1));
|
||||
if (StringUtils.isNotBlank(cellValue)) {
|
||||
if (!PhoneUtil.isMobile(cellValue)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列电话号码格式不正确,请检查后重新导入", rowIndex + 1, colIndex + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1199,7 +1199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
type_id as typeId,
|
||||
type_name as typeName,
|
||||
manage_type as manageType,
|
||||
lease_price as dayLeasePrice
|
||||
lease_price as dayLeasePrice,
|
||||
unit_name as unitName
|
||||
FROM
|
||||
ma_type
|
||||
WHERE
|
||||
|
|
|
|||
|
|
@ -542,17 +542,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getLeaseAnswerRate" resultType="com.bonus.material.largeScreen.entity.MaLeaseAnswerInfo">
|
||||
SELECT
|
||||
ml.lease_name AS deviceName,
|
||||
COUNT( 1 ) AS publishCount,
|
||||
SUM( CASE WHEN ml.lease_status = '1' THEN 1 ELSE 0 END ) AS orderCount,
|
||||
GROUP_CONCAT( DISTINCT md.type_id ) as typeId,
|
||||
COUNT( ml.lease_name ) AS publishCount,
|
||||
SUM( CASE WHEN ml.lease_status in (1, 3) THEN 1 ELSE 0 END ) AS orderCount,
|
||||
GROUP_CONCAT( DISTINCT a.type_id ) as typeId,
|
||||
-- 计算百分比,避免除零错误
|
||||
CASE
|
||||
WHEN COUNT(1) = 0 THEN NULL
|
||||
ELSE ROUND((SUM(CASE WHEN ml.lease_status = '1' THEN 1 ELSE 0 END) / COUNT(1)) * 100, 2)
|
||||
ELSE ROUND((SUM(CASE WHEN ml.lease_status in (1, 3) THEN 1 ELSE 0 END) / COUNT(1)) * 100, 2)
|
||||
END AS answerRate
|
||||
FROM
|
||||
ma_lease_info ml
|
||||
LEFT JOIN ma_lease_details md ON ml.id = md.lease_id
|
||||
LEFT JOIN (SELECT lease_id,GROUP_CONCAT(type_id) as type_id from ma_lease_details GROUP BY lease_id) a
|
||||
ON ml.id = a.lease_id
|
||||
GROUP BY
|
||||
ml.lease_name
|
||||
</select>
|
||||
|
|
@ -592,7 +593,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY
|
||||
ml.id
|
||||
ORDER BY
|
||||
ml.start_time DESC
|
||||
COUNT( md.lease_num ) DESC
|
||||
</select>
|
||||
|
||||
<select id="getLeaseTypeList" resultType="com.bonus.material.largeScreen.entity.MaLeaseOnlyInfo">
|
||||
|
|
@ -614,13 +615,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt1.type_name AS typeName,
|
||||
md.device_name AS deviceName,
|
||||
mt.type_name AS modelCode,
|
||||
md.total_up_day AS upTotal,
|
||||
md.total_lease_day AS leaseTotal,
|
||||
CASE
|
||||
|
||||
WHEN ( md.total_lease_day + md.total_up_day ) = 0 THEN
|
||||
NULL ELSE ROUND(( md.total_lease_day / ( md.total_lease_day + md.total_up_day )) * 100, 2 )
|
||||
END AS rate
|
||||
IFNULL(SUM(md.total_up_day), 0) AS upTotal,
|
||||
IFNULL(SUM(md.total_lease_day), 0) AS leaseTotal,
|
||||
-- 计算利用率,保留两位小数,处理除零错误
|
||||
CASE
|
||||
WHEN IFNULL(SUM(md.total_lease_day), 0) + IFNULL(SUM(md.total_up_day), 0) = 0 THEN 0.00
|
||||
ELSE ROUND(IFNULL(SUM(md.total_lease_day), 0) / (IFNULL(SUM(md.total_lease_day), 0) + IFNULL(SUM(md.total_up_day), 0)), 2)
|
||||
END AS rate
|
||||
FROM
|
||||
ma_dev_info md
|
||||
LEFT JOIN ma_type mt ON md.type_id = mt.type_id
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue