package com.zcloud.accident.service;

import com.jjb.saas.framework.utils.DataEncryptDecryptUtil;
import com.zcloud.accident.api.AccidentServiceI;
import com.zcloud.accident.command.AccidentAddExe;
import com.zcloud.accident.command.AccidentRemoveExe;
import com.zcloud.accident.command.AccidentUpdateExe;
import com.zcloud.accident.command.query.AccidentQueryExe;
import com.zcloud.accident.dto.AccidentAddCmd;
import com.zcloud.accident.dto.AccidentCountQry;
import com.zcloud.accident.dto.AccidentPageQry;
import com.zcloud.accident.dto.AccidentUpdateCmd;
import com.zcloud.accident.dto.clientobject.AccidentCO;
import com.zcloud.accident.dto.clientobject.AccidentCorpCountStatCO;
import com.zcloud.accident.dto.clientobject.AccidentCountStatCO;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.alibaba.cola.dto.MultiResponse;
import com.zcloud.gbscommon.utils.Tools;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* web-app
* @Author fangjiakai
* @Date 2025-10-29 14:28:52
*/
@Service
@AllArgsConstructor
public class AccidentServiceImpl implements AccidentServiceI {
    private final AccidentAddExe accidentAddExe;
    private final AccidentUpdateExe accidentUpdateExe;
    private final AccidentRemoveExe accidentRemoveExe;
    private final AccidentQueryExe accidentQueryExe;


    @Override
    public AccidentCO  queryById(Long id){
        return accidentQueryExe.queryById(id);
    }
    @Override
    public PageResponse<AccidentCO> listPage(AccidentPageQry qry){
        return accidentQueryExe.execute(qry);
    }

    @Override
    public List<AccidentCO> listAll(AccidentPageQry qry) {
        return accidentQueryExe.listAll(qry);
    }

    @Override
    public SingleResponse add(AccidentAddCmd cmd) {

        accidentAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(AccidentUpdateCmd accidentUpdateCmd) {
        accidentUpdateExe.execute(accidentUpdateCmd);
    }

    @Override
    public void remove(Long id) {
        accidentRemoveExe.execute(id);
    }

    @Override
    public void removeBatch(Long[] ids) {
        accidentRemoveExe.execute(ids);
    }

    @Override
    public MultiResponse<AccidentCorpCountStatCO> countByCorpinfo(AccidentCountQry accidentCountQry) {
        return accidentQueryExe.countByCorpinfo(accidentCountQry);
    }

    @Override
    public MultiResponse<AccidentCountStatCO> countByCorpinfoIdAndIncidentType(AccidentCountQry accidentCountQry) {
        return accidentQueryExe.countByCorpinfoIdAndIncidentType(accidentCountQry);
    }

}

