package com.miaxis.app.controller.fulu;

import com.alibaba.fastjson.JSONObject;
import com.miaxis.common.constant.Constants;
import com.miaxis.common.core.controller.BaseController;
import com.miaxis.common.core.domain.Response;
import com.miaxis.common.exception.CustomException;
import com.miaxis.common.sms.MD5Utils;
import com.miaxis.feign.dto.FilmDTO;
import com.miaxis.feign.dto.fulu.FuluCommonApiDTO;
import com.miaxis.feign.dto.fulu.FuluDTO;
import com.miaxis.feign.dto.fulu.FuluResult;
import com.miaxis.feign.service.IFuluService;
import com.miaxis.wx.service.IWxOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;

import static com.miaxis.common.constant.Constants.FILM_BLACK_LIST;

/**
 * 【小程序-客户信息】Controller
 *
 */
@RestController
@RequiredArgsConstructor
@RequestMapping(Constants.STUDENT_PREFIX+"/fulu")
@Api(tags = {"【小程序-福禄】"})
@Slf4j
public class FuluController extends BaseController {


    @Autowired
    private IFuluService fuluService;


    @Autowired
    private IWxOrderService wxOrderService;
    @Value("${fulu.appKey}")
    private String appKey;
    @Value("${fulu.appSecret}")
    private String appSecret;

    @PostMapping(value = "/fuluCommonApi")
    @ApiOperation("福禄通用接口")
    public  Response<FuluResult>  httpPostWithForm(@RequestBody FuluCommonApiDTO fuluCommonApiDTO) {


        FuluDTO fuluDTO = new FuluDTO();
        wxOrderService.init(fuluDTO,fuluCommonApiDTO);
        // 用于接收返回的结果
        return Response.success(fuluService.fuluCommonApi(fuluDTO));
    }




}
