package com.bcxin.ins.coninsweb.user.web;

import com.bcxin.ins.common.http.MessageUtils;
import com.bcxin.ins.core.base.web.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

/**
 * 第三方用户控制器
 */
@Controller
//@RequestMapping(value = "{apiPath}/interaction/user")
public class UserThirdPartyController extends BaseController {





    /**
     * 查询企业用户是否有权限购买
     * @param data
     * @param response
     */
    @RequestMapping("/getStatusByUserId")
    public void getStatusByUserId(String data, HttpServletResponse response){
        Map<String, Object> map = new HashMap<String, Object>();

//        try {
//            String webType = MessageUtils.getStringValueByKey(data,"webType");//平台类型
//            String user_id =MessageUtils.getStringValueByKey(data,"user_id");//用户id
//            SysUser oldSysUser = sysUserAPIService.getUserByWebUserId(user_id,webType);
//            String  date= DateUtil.formatDate(new Date());
//            if(oldSysUser!=null){
//                int num = sysUserAPIService.getStatusByUserId(String.valueOf(oldSysUser.getId()),date);
//
//                oldSysUser.getId();
//                returnSuccessStatus(map);
//            }else{
//                returnFailedStatus(map,"500","该用户信息未同步");
//
//            }
//        } catch (Exception e) {
//            returnFailedStatus(map);
//            e.printStackTrace();
//        }
        MessageUtils.returnMessage(MessageUtils.packageMap(map), response);
    }





    /**
     * 查询用户是否有购买保险
     * @param data
     * @param response
     */
    @RequestMapping("/getPurchaseInsurance")
    public void getPurchaseInsurance(String data, HttpServletResponse response){
        Map<String, Object> map = new HashMap<String, Object>();

//        try {
//            String webType =MessageUtils.getStringValueByKey(data,"webType");//平台类型
//            String oid =MessageUtils.getStringValueByKey(data,"oid");//订单id
//            String idcard =MessageUtils.getStringValueByKey(data,"idcard");//身份证
//
//            boolean flag=sysUserAPIService.getPurchaseInsurance(oid,idcard, DateUtil.getDate("yyyy-MM-dd HH:mm:ss"),webType);
//            map.put("flag",flag);
//            returnSuccessStatus(map);
//
//        } catch (Exception e) {
//            returnFailedStatus(map);
//            e.printStackTrace();
//        }
        MessageUtils.returnMessage(MessageUtils.packageMap(map), response);
    }


}
