songhuangfeng123
2022-08-17 8702c17288c16ec3d6760326e85cae37bbb10af8
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
@@ -16,17 +16,13 @@
import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentReportReqDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.*;
import com.gkhy.safePlatform.incidentManage.query.AccidentReportQuery;
import com.gkhy.safePlatform.incidentManage.query.AccidentReportRPCQuery;
import com.gkhy.safePlatform.incidentManage.query.db.AccidentReportDBQuery;
import com.gkhy.safePlatform.incidentManage.query.db.AccidentReportRPCDBQuery;
import com.gkhy.safePlatform.incidentManage.service.AccidentReportService;
import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressFileInfoService;
import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressInfoService;
import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentReportFileInfoService;
import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentReportInfoService;
import com.gkhy.safePlatform.incidentManage.utils.TimeUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -310,31 +306,6 @@
        if (AccidentReportReqDTO.getFillInTime() == null) {
            throw new AccidentException(AccidentResultCodes.REPORT_FILL_IN_TIME_NULL);
        }
    }
    @Override
    public ResultVO<List<AccidentReportCountRespDTO>> countAccidentReport(AccidentReportRPCQuery query) {
        List<AccidentReportCount> list = new ArrayList<>();
        AccidentReportRPCDBQuery dbQuery = new AccidentReportRPCDBQuery();
        if (query.getType()==1){
            // 月
            int year = query.getYear();
            int month = query.getMonth();
            dbQuery.setStartTime(TimeUtils.getMonthFirst(year,month));
            dbQuery.setEndTime(TimeUtils.getMonthLast(year,month));
            list = accidentReportInfoService.selectByTimeAndType(dbQuery);
        }
        if (query.getType()==2){
            // 年
            int year = query.getYear();
            dbQuery.setStartTime(TimeUtils.getYearFirst(year));
            dbQuery.setEndTime(TimeUtils.getYearLast(year));
            list = accidentReportInfoService.selectByTimeAndType(dbQuery);
        }
        List<AccidentReportCountRespDTO> accidentReportCountRespDTOList = BeanCopyUtils.copyBeanList(list,AccidentReportCountRespDTO.class);
        return new ResultVO<>(ResultCodes.OK,accidentReportCountRespDTOList);
    }
}