08ed838b 康伟

kangwei: 设备中心半年、全年时间条件

1 个父辈 11e8dfa4
......@@ -629,6 +629,27 @@ public class DateUtils {
return sdf.format(preDate);
}
/***
* 获取几个月之后日期
* @param month
* @return
*/
public static String getDateByAfterMonth(int month) {
// 设置日期格式
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// 创建一个Calendar实例,并设置为当前日期和时间
Calendar calendar = Calendar.getInstance();
// 减去半年(6个月)
//calendar.add(Calendar.MONTH, -6);
calendar.add(Calendar.MONTH, month);
// Date preDate = calendar.getTime();
// 获取半年前的日期
String afterDate = dateFormat.format(calendar.getTime());
return afterDate;
}
/**
* 获取日期时间集合
* @param start
......
......@@ -62,14 +62,14 @@ public class ReportStatisticsDTO {
public String getLastYearStartTime() {
if(StringUtils.isEmpty(lastYearStartTime)){
lastYearStartTime = DateUtils.getTbDate(lastYearStartTime);
lastYearStartTime = DateUtils.getTbDate(startTime);
}
return lastYearStartTime;
}
public String getLastYearEndTime() {
if(StringUtils.isEmpty(lastYearEndTime)){
lastYearEndTime = DateUtils.getTbDate(lastYearEndTime);
lastYearEndTime = DateUtils.getTbDate(endTime);
}
return lastYearEndTime;
}
......@@ -81,8 +81,8 @@ public class ReportStatisticsDTO {
}else{
time = DateUtils.getCurrentYear()+"";
}
}
return time;
}
}
......
......@@ -11,7 +11,9 @@ import com.skua.modules.equipment.dto.ReportStatisticsDTO;
import com.skua.modules.equipment.mapper.ProductionEquipmentMapper;
import com.skua.modules.equipment.service.IProductionEquipmentService;
import com.skua.modules.equipment.vo.*;
import com.skua.tool.util.DateUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -218,7 +220,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
//本月新增
productionEquipmentVO.setIncrease(increase);
//设备完好率
BigDecimal bigDecimal = new BigDecimal(v*100).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal bigDecimal = new BigDecimal(ConvertUtils.getDou(v,0d)*100).setScale(2, BigDecimal.ROUND_HALF_UP);
productionEquipmentVO.setEquipmentIntactRate(bigDecimal.toString() + "%");
//设备完好总台日
BigDecimal bigDecimal5 = new BigDecimal(goodDay).setScale(2, BigDecimal.ROUND_HALF_UP);
......@@ -387,6 +389,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
List<Map<String,Object>> mapList = commonSqlService.queryForList(dict_sql);
List<String> categoryNameList = new ArrayList<>();
List<String> categoryIdList = new ArrayList<>();*/
String startTime;
String endTime = DateUtils.getDateByAfterMonth(0);//当前日期
if (6 == reportStatisticsDTO.getTimeUnit()) {
startTime = DateUtils.getDateByAfterMonth(-6);
} else {
startTime = DateUtils.getDateByAfterMonth(-12);
}
reportStatisticsDTO.setStartTime(startTime);
reportStatisticsDTO.setEndTime(endTime);
return productionEquipmentMapper.getEquipmentStatisticsDetailsNew(pageList,reportStatisticsDTO);
}
@Override
......@@ -491,7 +502,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
List<ContrastVO> list = new ArrayList<>();
List<Map> rate = null;
List<Map> onYearRate = new ArrayList<>();
if (reportStatisticsDTO.getTimeUnit() == 6) {
if (6 == reportStatisticsDTO.getTimeUnit()) {
rate = productionEquipmentMapper.getHalfIntactRate();
onYearRate = productionEquipmentMapper.getHalfIntactYearOnYearRate();
} else {
......@@ -627,6 +638,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
//设备完好率详情(新)
public List<Map> getEquipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) {
String startTime;
String endTime = DateUtils.getDateByAfterMonth(0);//当前日期
if (6 == reportStatisticsDTO.getTimeUnit()) {
startTime = DateUtils.getDateByAfterMonth(-6);
} else {
startTime = DateUtils.getDateByAfterMonth(-12);
}
reportStatisticsDTO.setStartTime(startTime);
reportStatisticsDTO.setEndTime(endTime);
return productionEquipmentMapper.getEquipmentIntactRateDetailsNew(reportStatisticsDTO);
}
@Override
......@@ -636,7 +656,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
List<Map> MTBF = new ArrayList<>();
//平均修复时间
List<Map> MTTR = new ArrayList<>();
if (reportStatisticsDTO.getTimeUnit() == 6) {
if (6 == reportStatisticsDTO.getTimeUnit()) {
MTBF = productionEquipmentMapper.getHalfIntactMTBF(); //平均故障时间
MTTR = productionEquipmentMapper.getHalfIntactMTTR();
} else {
......@@ -786,7 +806,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
List<ContrastVO> contrastVOS = new ArrayList<>();
List<Map> completeRate = new ArrayList<>();
List<Map> completeYearOnYearRate = new ArrayList<>();
if (reportStatisticsDTO.getTimeUnit() == 6) {
if (6 == reportStatisticsDTO.getTimeUnit()) {
completeRate = productionEquipmentMapper.getHalfIntactCompleteRate();
completeYearOnYearRate = productionEquipmentMapper.getHalfIntactCompleteYearOnYearRate();
} else {
......@@ -834,6 +854,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
* @return
*/
public List<Map> getMaintainCompleteRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) {
String startTime;
String endTime = DateUtils.getDateByAfterMonth(0);//当前日期
if (6 == reportStatisticsDTO.getTimeUnit() ) {
startTime = DateUtils.getDateByAfterMonth(-6);
} else {
startTime = DateUtils.getDateByAfterMonth(-12);
}
reportStatisticsDTO.setStartTime(startTime);
reportStatisticsDTO.setEndTime(endTime);
return productionEquipmentMapper.getMaintainCompleteRateDetails(reportStatisticsDTO);
}
@Override
......@@ -941,7 +970,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
List<ContrastVO> list = new ArrayList<>();
List<Map> contrastCost = new ArrayList<>();
if (reportStatisticsDTO.getTimeUnit() == 6) {//半年
if (6 == reportStatisticsDTO.getTimeUnit() ) {//半年
contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(reportStatisticsDTO.getDepartIds());
} else {
contrastCost = productionEquipmentMapper.getOneYearContrastCost(reportStatisticsDTO.getDepartIds());
......@@ -962,6 +991,16 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
//维护维修费用详情
@Override
public List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
String startTime;
String endTime = DateUtils.getDateByAfterMonth(0);//当前日期
if (6 == reportStatisticsDTO.getTimeUnit()) {
startTime = DateUtils.getDateByAfterMonth(-6);
} else {
startTime = DateUtils.getDateByAfterMonth(-12);
}
reportStatisticsDTO.setStartTime(startTime);
reportStatisticsDTO.setEndTime(endTime);
return productionEquipmentMapper.getContrastCostDetails(reportStatisticsDTO);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!