数据清洗, 调整导出
This commit is contained in:
parent
832a1d3972
commit
d26e02f364
@ -1,6 +1,7 @@
|
||||
package com.evotech.hd.common.core.Dto.order;
|
||||
|
||||
import com.evotech.hd.common.core.excel.Excel;
|
||||
import com.evotech.hd.common.core.excel.handler.impl.OrderStepExcelHandlerAdapter;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@ -15,11 +16,9 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
public class OrderStepExportVo {
|
||||
|
||||
Integer step;
|
||||
|
||||
@Excel(name="步骤")
|
||||
String name;
|
||||
@Excel(name="步骤", handler = OrderStepExcelHandlerAdapter.class)
|
||||
String stepName;
|
||||
@Excel(name="时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
Date stepTime;
|
||||
}
|
||||
|
||||
@ -16,17 +16,17 @@ public enum SwapBatteryStepEnum implements BaseEnum<Integer, String>{
|
||||
|
||||
VEHICLE_POSITION(2, "车辆到达指定位置"),
|
||||
|
||||
INSTITUTIONS_FOR_CHINA(3, "对中机构"),
|
||||
INSTITUTIONS_FOR_CHINA(3, "启动对中机构"),
|
||||
|
||||
GET_NEW_ELECTRICITY(4, "取新电"),
|
||||
GET_NEW_ELECTRICITY(4, "取新电池"),
|
||||
|
||||
DISMANTLE_OLD_ELECTRICITY(5, "拆旧电"),
|
||||
DISMANTLE_OLD_ELECTRICITY(5, "拆旧电池"),
|
||||
|
||||
INSTALL_NEW_ELECTRICITY(6, "装新电"),
|
||||
INSTALL_NEW_ELECTRICITY(6, "装新电池"),
|
||||
|
||||
DISCHARGE_OLD_ELECTRICITY(7, "放旧电"),
|
||||
DISCHARGE_OLD_ELECTRICITY(7, "放旧电池"),
|
||||
|
||||
COMPLETED(8, "完成"),
|
||||
COMPLETED(8, "换电完成"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.evotech.hd.common.core.excel.handler.impl;
|
||||
|
||||
import com.evotech.hd.common.core.enums.SwapBatteryStepEnum;
|
||||
import com.evotech.hd.common.core.excel.handler.ExcelHandlerAdapter;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
/**
|
||||
* OrderStatusExcelHandlerAdapter
|
||||
*
|
||||
* @author andy.shi
|
||||
* @ClassName:OrderStatusExcelHandlerAdapter
|
||||
* @date: 2026年02月11日 14:23
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
|
||||
public class OrderStepExcelHandlerAdapter implements ExcelHandlerAdapter {
|
||||
|
||||
@Override
|
||||
public Object format(Object value, String[] args, Cell cell, Workbook wb) {
|
||||
|
||||
if(ObjectUtils.isNotEmpty(value)){
|
||||
Integer val = Integer.valueOf(String.valueOf(value));
|
||||
for (SwapBatteryStepEnum stepEnum : SwapBatteryStepEnum.values()){
|
||||
if(stepEnum.getCode().equals(val)){
|
||||
return stepEnum.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ package com.evotech.hd.common.core.utils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 类
|
||||
@ -27,4 +28,10 @@ public class DataUtils {
|
||||
return dv;
|
||||
}
|
||||
|
||||
public static <K, V> V getValOrDefault(Map<K, V> map, K key, V dv) {
|
||||
if(!map.containsKey(key) || ObjectUtils.isEmpty(map.get(key))){
|
||||
return dv;
|
||||
}
|
||||
return map.get(key); // 键不存在时,Java默认返回null
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.List;
|
||||
* @since 2024-12-11
|
||||
*/
|
||||
public interface OrderSwapBatteryStepDao extends BaseMapper<OrderSwapBatteryStep> {
|
||||
|
||||
@Select(" select step_name as name, step, step_time as stepTime from hd_cloud_manage.yt_t_order_swap_battery_step where order_no=#{orderNo} order by step_time asc ")
|
||||
//推送时间不能作为排序标准
|
||||
@Select(" select step as stepName, step, step_time as stepTime from hd_cloud_manage.yt_t_order_swap_battery_step where order_no=#{orderNo} ORDER BY step_time asc")
|
||||
public List<OrderStepExportVo> findListByOrderNo(@Param("orderNo") String orderNo);
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evotech.hd.cloud.entity.request.PageListAlarmTemplateRequest;
|
||||
import com.evotech.hd.cloud.service.AlarmTemplateService;
|
||||
import com.evotech.hd.cloud.service.WechatUserService;
|
||||
import com.evotech.hd.cloud.service.rpc.WechatService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.Dto.ResultUtil;
|
||||
import com.evotech.hd.common.core.dao.cloud.AlarmTemplateDao;
|
||||
@ -35,8 +34,6 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class AlarmTemplateServiceImpl extends ServiceImpl<AlarmTemplateDao, AlarmTemplate> implements AlarmTemplateService {
|
||||
|
||||
@Resource
|
||||
WechatService wechatService;
|
||||
@Resource
|
||||
WechatUserService wechatUserService;
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
HomePlatformDataDetailDto detailDto = new HomePlatformDataDetailDto();
|
||||
detailDto.setProxyName(proxy.getPoname());
|
||||
final Long[] totalCount = {0l};
|
||||
batteryStationMap.get(proxy.getPocode()).forEach(stationCode ->{
|
||||
DataUtils.getValOrDefault(batteryStationMap,proxy.getPocode(), Collections.emptyList()).forEach(stationCode ->{
|
||||
Long stationQuantity = finalCountMap.get(stationCode);
|
||||
totalCount[0] = defaultValue(totalCount[0],0l) + defaultValue(stationQuantity,0l);
|
||||
});
|
||||
|
||||
@ -176,7 +176,7 @@
|
||||
od.rent_bat_soc,
|
||||
od.service_time_begin,
|
||||
od.service_time_end
|
||||
from hd_cloud_manage.yt_t_order ocd /o
|
||||
from hd_cloud_manage.yt_t_order o
|
||||
left join hd_cloud_manage.yt_t_order_detail od on od.order_id = o.pk_id
|
||||
left join hd_cloud_manage.yt_t_order_swap_battery_pre osbp on osbp.pk_id = o.order_pre_id
|
||||
<if test="proCode!= null and proCode!= ''">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user