package com.sifang.modules.smallprogram.yuexiu;

import com.sifang.modules.sunshine.SystemSetting.utils.Result;
import com.sifang.modules.sunshine.partnerManagement.entity.CrmPartner;
import com.sifang.modules.sunshine.partnerManagement.service.PartnerService;
import com.sifang.modules.sys.web.BaseExceptionController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

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

@Controller
@RequestMapping(value = "${adminPath}/main/yueXiuCommon")
public class YueXiuCommonController extends BaseExceptionController {

    @Autowired
    private PartnerService partnerService;

    @ResponseBody
    @RequestMapping(value = "getPartnerSet")
    public Result getPartnerSet(HttpServletRequest request){
        String partnerId=request.getParameter("partnerId");
        CrmPartner partner=partnerService.getById(partnerId);
        Map<String,Object> resultMap=new HashMap<>();
        resultMap.put("overageFlag",partner.getOverageFlag());
        resultMap.put("failCreateAge",partner.getFailCreateAge());
        resultMap.put("needSignerAge",partner.getNeedSignerAge());
        resultMap.put("signerConditionAge",partner.getSignerConditionAge());
        resultMap.put("partnerId",partnerId);
        return Result.success(resultMap);
    }
}
