package com.zt.plat.module.erp.service.erp;

import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.erp.api.ErpExternalApi;
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import java.util.HashMap;
import java.util.Map;

@Service
@Validated
public class ErpInvoiceRecheckServiceImpl implements ErpInvoiceRecheckService {
    @Resource
    public ErpExternalApi erpExternalApi;
    @Override
    public Map<String, String> submit082(Map<String, Object> param) {
        ErpSubmitReqDTO reqDTO = new ErpSubmitReqDTO();
        reqDTO.setFuncnr("082");
        reqDTO.setBskey(param.get("id").toString());
        reqDTO.setUsrid(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
        reqDTO.setUsrnm((SecurityFrameworkUtils.getLoginUserNickname()));
        param.remove("id");//移除id字段
        reqDTO.setReq(param);
        return erpExternalApi.submitDataToErp(reqDTO);
    }

    @Override
    public Map<String, String> submit085(Map<String, Object> param) {
        ErpSubmitReqDTO reqDTO = new ErpSubmitReqDTO();
        reqDTO.setFuncnr("085");
        reqDTO.setBskey(param.get("id").toString());
        reqDTO.setUsrid(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
        reqDTO.setUsrnm((SecurityFrameworkUtils.getLoginUserNickname()));
        param.remove("id");
        reqDTO.setReq(param);
        return erpExternalApi.submitDataToErp(reqDTO);
    }
}
