//package com.tofly.xrtygis.handle.table;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.tofly.xrtygis.entity.Dmatable;
//import com.tofly.xrtygis.entity.TfDeviceArchiveManage;
//import com.tofly.xrtygis.service.DmatableService;
//import com.tofly.xrtygis.service.TfDeviceArchiveManageService;
//import com.xxl.job.core.biz.model.ReturnT;
//import com.xxl.job.core.handler.annotation.XxlJob;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
//@Component
//@Slf4j
//public class DmaTableHandler {
//    @Autowired
//    private DmatableService dmatableService;
//    @Autowired
//    private TfDeviceArchiveManageService deviceArchiveManageService;
//
//    /**
//     * DMA 区域表同步设备档案计量类型数据
//     * @param param
//     * @return
//     */
//    @XxlJob("dmaTableHandler")
//    public ReturnT<String> dmaTableHandler(String param) {
//        long l = System.currentTimeMillis();
//        log.info("开始区域表同步设备档案计量类型数据");
//        List<Dmatable> list = dmatableService.list();
//        // 设备台账计量表 与 区域表 1对1
//        Map<Long, Dmatable> dmaTableMap = list.stream().collect(Collectors.toMap(Dmatable::getDeviceId, m -> m, (key1, key2) -> key2));
//        List<Long> deviceIdList = deviceArchiveManageService.list(new QueryWrapper<TfDeviceArchiveManage>().lambda().eq(TfDeviceArchiveManage::getDeviceType, '3').select(TfDeviceArchiveManage::getId)).stream().map(TfDeviceArchiveManage::getId).collect(Collectors.toList());
//        deviceIdList.forEach(deviceId->{
//            Dmatable dmatable = dmaTableMap.get(deviceId);
//            if(null==dmatable){
//                Dmatable saveTable = new Dmatable();
//                saveTable.setDeviceId(deviceId);
//                saveTable.setUsfl("1");
//                dmatableService.save(saveTable);
//            }
//        });
//
//        long l1 = System.currentTimeMillis();
//        log.info("结束区域表同步设备档案计量类型数据,用时{}mm",l1-l);
//        return ReturnT.SUCCESS;
//    }
//}
