package com.huyi.service.common.financeInf.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huyi.service.base.entity.*;
import com.huyi.service.base.service.*;
import com.huyi.service.common.financeInf.service.FinanceInfService;
import com.huyi.service.credit.service.OwnCreditService;
import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
import com.tianhu.common.core.constant.SalaryConstants;
import com.tianhu.common.core.domain.R;
import com.tianhu.common.core.utils.AmtUtil;
import com.tianhu.common.core.utils.CommonUtil;
import com.tianhu.common.core.utils.DateUtils;
import com.tianhu.common.core.utils.IdUtils;
import com.tianhu.common.core.web.controller.BaseController;
import com.tianhu.common.core.web.domain.AjaxResult;
import com.tianhu.common.log.annotation.Log;
import com.tianhu.common.log.enums.BusinessType;
import com.tianhu.common.security.annotation.PreAuthorize;
import com.tianhu.common.security.service.TokenService;
import com.tianhu.system.api.domain.SysUser;
import com.tianhu.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 融信信息
 * pxh
 * 2021-08-24
 */
@RestController
@RequestMapping("/financeInf")
public class FinanceInfController extends BaseController {
    @Autowired
    private TokenService tokenService;
    @Autowired
    private IZcFinanceInfService iZcFinanceInfService;
    @Autowired
    private FinanceInfService financeInfService;

    /**
     * 查询融信(融资用
     * @return
     */
    @PreAuthorize(hasPermi = "finance:inf:list")
    @GetMapping("/list")
    public R list() {
        //查询当前操作员
        LoginUser userInfo = tokenService.getLoginUser();
        SysUser user = userInfo.getSysUser();
        //获取企业
        String companyId = user.getCompanyId();
        Map map = new HashMap();
        map.put("companyId",companyId);
        List<Map> list = financeInfService.selectFinanceInfList(map);
//        LambdaQueryWrapper<ZcFinanceInf> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(ZcFinanceInf::getZfiSupplierId,companyId);
//        queryWrapper.eq(ZcFinanceInf::getZfiStatus,"02");
//        List<ZcFinanceInf> list = iZcFinanceInfService.findZcFinanceInfs(queryWrapper);
        return R.ok(list);
    }

}
