package com.nantian.cloud.dbcapp.controller;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nantian.cloud.dbcapp.entity.CompanyContacter;
import com.nantian.cloud.dbcapp.entity.EnterpriseState;
import com.nantian.cloud.dbcapp.service.CompanyContacterService;
import com.nantian.cloud.dbcapp.service.EnterpriseStateService;
import com.nantian.sc.cloud.common.core.util.R;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Calendar;
import java.util.Date;
import java.util.List;


/**
* @Description: 企业状态

*/
@CrossOrigin
@RestController
@AllArgsConstructor
@RequestMapping("/companyContacter")
@Api(value = "companyContacter", tags = "企业联系人列表")

public class CompanyContacterController {

    private final CompanyContacterService companyContacterService;

    @PostMapping("/save")
    public R saveCompanyContacter(@RequestBody String str){
        JSONObject json = JSONObject.parseObject(str);
        String data = json.getString("list");
        List<CompanyContacter> list = (List<CompanyContacter>) JSONArray.parseArray(data, CompanyContacter.class);
        Object o = companyContacterService.saveCompanyContacter(list);
        return R.ok(o);
    }

    @GetMapping("/getData")
    public R getData(String epc){
        List<CompanyContacter> list = companyContacterService.getData(epc);
        return R.ok(list);
    }

}
