Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 9 months ago
parent
commit
23a5a591cf
  1. 12
      hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java
  2. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  3. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java
  4. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

12
hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java

@ -2,6 +2,7 @@ package com.hnac.hzims.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -15,28 +16,39 @@ import java.util.List;
@ApiModel("各个票种统计表")
public class VoteChartVo {
@ApiModelProperty(value = "站点名称")
@ColumnWidth(value = 20)
@ExcelProperty(value = "站点名称", index = 0)
private String name;
@ApiModelProperty(value = "总数量")
@ExcelProperty(value = "总数量", index = 1)
@ColumnWidth(value = 20)
private int sumNum;
@ApiModelProperty(value = "总数量id")
@ExcelIgnore
private List<Long> sumIds;
@ApiModelProperty(value = "未完成数量")
@ExcelProperty(value = "未完成数量", index = 2)
@ColumnWidth(value = 20)
private int undoneNum;
@ApiModelProperty(value = "未完成id")
@ExcelIgnore
private List<Long> undoneIds;
@ApiModelProperty(value = "完成数量")
@ColumnWidth(value = 20)
@ExcelProperty(value = "完成数量", index = 3)
private int finishNum;
@ApiModelProperty(value = "完成id")
@ExcelIgnore
private List<Long> finishIds;
@ApiModelProperty(value = "完成率")
@ExcelProperty(value = "完成率", index = 4)
@ColumnWidth(value = 20)
private Double finishRate;
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -72,6 +72,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@ -573,6 +575,12 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
voteChartVo.setFinishIds(finishIds);
voteChartVo.setUndoneNum(undoneIds.size());
voteChartVo.setUndoneIds(undoneIds);
if (CollectionUtil.isEmpty(list)||CollectionUtil.isEmpty(undoneIds)){
voteChartVo.setFinishRate(0.00d);
}else {
BigDecimal divide = new BigDecimal(finishIds.size()).divide(new BigDecimal(list.size()),2, RoundingMode.UP);
voteChartVo.setFinishRate(divide.doubleValue());
}
return voteChartVo;
}

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java

@ -134,14 +134,14 @@ public class OperMaintenanceTaskController extends BladeController {
= "日常维护记录导出")
public void exportMaintenance(HttpServletResponse response,@RequestBody OperMaintenanceTaskDTO req) {
try {
if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){
LocalDateTime date = LocalDateTime.now();
String nowDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
String firstDate = firstDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
req.setStartTime(firstDate);
req.setEndTime(nowDate);
}
// if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){
// LocalDateTime date = LocalDateTime.now();
// String nowDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
// String firstDate = firstDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// req.setStartTime(firstDate);
// req.setEndTime(nowDate);
// }
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -58,6 +58,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@ -597,6 +599,12 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
voteChartVo.setFinishIds(finishIds);
voteChartVo.setUndoneNum(undoneIds.size());
voteChartVo.setUndoneIds(undoneIds);
if (CollectionUtil.isEmpty(list)||CollectionUtil.isEmpty(undoneIds)){
voteChartVo.setFinishRate(0.00d);
}else {
BigDecimal divide = new BigDecimal(finishIds.size()).divide(new BigDecimal(list.size()),2, RoundingMode.UP);
voteChartVo.setFinishRate(divide.doubleValue());
}
return voteChartVo;
}
}

Loading…
Cancel
Save