package org.jeecg.modules.projectManagement.controller;

import java.math.BigDecimal;
import java.util.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.NumberFormat;
import java.util.regex.Pattern;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Maps;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.basedata.entity.*;
import org.jeecg.modules.projectManagement.entity.fdProjectQuotationFee;
import org.jeecg.modules.projectManagement.service.IFdContractProportionService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecg.modules.projectManagement.entity.FdContract;
import org.jeecg.modules.projectManagement.entity.FdContractProportion;
import org.jeecg.modules.projectManagement.service.IFdProjectQuotationTemplateItemService;
import org.jeecg.modules.projectManagement.service.IFdProjectQuotationTemplateService;
import org.jeecg.modules.basedata.service.IFdQuotationTemplateService;
import org.jeecg.modules.projectManagement.entity.FdProjectQuotationTemplateItem;
import org.jeecg.modules.projectManagement.service.IfdProjectQuotationFeeService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;

/**
 * @Title: Controller
 * @Description: 合同比例表
 * @author： jeecg-boot
 * @date： 2019-05-27
 * @version： V1.0
 */
@RestController
@RequestMapping("/projectManagement/fdContractProportion")
@Slf4j
public class FdContractProportionController {
    @Autowired
    private IFdContractProportionService fdContractProportionService;

    @Resource
    private IFdQuotationTemplateService fdQuotationTemplateService;

    @Resource
    private IFdProjectQuotationTemplateService fdProjectQuotationTemplateService;

    @Resource
    private IFdProjectQuotationTemplateItemService fdProjectQuotationTemplateItemService;
    @Resource
    IfdProjectQuotationFeeService ifdProjectQuotationFeeService;

    /**
     * 分页列表查询
     *
     * @param fdContractProportion
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @GetMapping(value = "/list")
    public Result<IPage<FdContractProportion>> queryPageList(FdContractProportion fdContractProportion,
                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                             HttpServletRequest req) {
        Result<IPage<FdContractProportion>> result = new Result<IPage<FdContractProportion>>();
        QueryWrapper<FdContractProportion> queryWrapper = QueryGenerator.initQueryWrapper(fdContractProportion, req.getParameterMap());
        Page<FdContractProportion> page = new Page<FdContractProportion>(pageNo, pageSize);
        IPage<FdContractProportion> pageList = fdContractProportionService.page(page, queryWrapper);
        result.setSuccess(true);
        result.setResult(pageList);
        return result;
    }

    /**
     * 添加
     *
     * @param fdContractProportion
     * @return
     */
    @PostMapping(value = "/add")
    public Result<FdContractProportion> add(@RequestBody FdContractProportion fdContractProportion) {
        Result<FdContractProportion> result = new Result<FdContractProportion>();
        try {
            fdContractProportionService.save(fdContractProportion);
            result.success("添加成功！");
        } catch (Exception e) {
            e.printStackTrace();
            log.info(e.getMessage());
            result.error500("操作失败");
        }
        return result;
    }

    /**
     * 编辑
     *
     * @param fdContractProportion
     * @return
     */
    @PutMapping(value = "/edit")
    public Result<FdContractProportion> edit(@RequestBody FdContractProportion fdContractProportion) {
        Result<FdContractProportion> result = new Result<FdContractProportion>();
        FdContractProportion fdContractProportionEntity = fdContractProportionService.getById(fdContractProportion.getId());
        if (fdContractProportionEntity == null) {
            result.error500("未找到对应实体");
        } else {
            boolean ok = fdContractProportionService.updateById(fdContractProportion);
            //TODO 返回false说明什么？
            if (ok) {
                result.success("修改成功!");
            }
        }

        return result;
    }

    /**
     * 通过id删除
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/delete")
    public Result<FdContractProportion> delete(@RequestParam(name = "id", required = true) String id) {
        Result<FdContractProportion> result = new Result<FdContractProportion>();
        FdContractProportion fdContractProportion = fdContractProportionService.getById(id);
        if (fdContractProportion == null) {
            result.error500("未找到对应实体");
        } else {
            boolean ok = fdContractProportionService.removeById(id);
            if (ok) {
                result.success("删除成功!");
            }
        }

        return result;
    }

    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    @DeleteMapping(value = "/deleteBatch")
    public Result<FdContractProportion> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        Result<FdContractProportion> result = new Result<FdContractProportion>();
        if (ids == null || "".equals(ids.trim())) {
            result.error500("参数不识别！");
        } else {
            this.fdContractProportionService.removeByIds(Arrays.asList(ids.split(",")));
            result.success("删除成功!");
        }
        return result;
    }

    /**
     * 通过id查询
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/queryById")
    public Result<FdContractProportion> queryById(@RequestParam(name = "id", required = true) String id) {
        Result<FdContractProportion> result = new Result<FdContractProportion>();
        FdContractProportion fdContractProportion = fdContractProportionService.getById(id);
        if (fdContractProportion == null) {
            result.error500("未找到对应实体");
        } else {
            result.setResult(fdContractProportion);
            result.setSuccess(true);
        }
        return result;
    }

    /**
     * 导出excel
     *
     * @param request
     * @param response
     */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
        // Step.1 组装查询条件
        QueryWrapper<FdContractProportion> queryWrapper = null;
        try {
            String paramsStr = request.getParameter("paramsStr");
            if (oConvertUtils.isNotEmpty(paramsStr)) {
                String deString = URLDecoder.decode(paramsStr, "UTF-8");
                FdContractProportion fdContractProportion = JSON.parseObject(deString, FdContractProportion.class);
                queryWrapper = QueryGenerator.initQueryWrapper(fdContractProportion, request.getParameterMap());
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        //Step.2 AutoPoi 导出Excel
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        List<FdContractProportion> pageList = fdContractProportionService.list(queryWrapper);
        //导出文件名称
        mv.addObject(NormalExcelConstants.FILE_NAME, "合同比例表列表");
        mv.addObject(NormalExcelConstants.CLASS, FdContractProportion.class);
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("合同比例表列表数据", "导出人:Jeecg", "导出信息"));
        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
        return mv;
    }

    /**
     * 通过excel导入数据
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
            MultipartFile file = entity.getValue();// 获取上传文件对象
            ImportParams params = new ImportParams();
            params.setTitleRows(2);
            params.setHeadRows(1);
            params.setNeedSave(true);
            try {
                List<FdContractProportion> listFdContractProportions = ExcelImportUtil.importExcel(file.getInputStream(), FdContractProportion.class, params);
                for (FdContractProportion fdContractProportionExcel : listFdContractProportions) {
                    fdContractProportionService.save(fdContractProportionExcel);
                }
                return Result.ok("文件导入成功！数据行数：" + listFdContractProportions.size());
            } catch (Exception e) {
                log.error(e.getMessage());
                return Result.error("文件导入失败！");
            } finally {
                try {
                    file.getInputStream().close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return Result.ok("文件导入失败！");
    }

    /***
     * @Title:获取生物分析与临床的比例
            * @Description:TODO
            * @param fdContract
            * @return org.jeecg.common.api.vo.Result<java.util.List<org.jeecg.modules.projectManagement.entity.FdContractProportion>>
            * @exception 
            * @author 陈创
            * @date 2019/11/25 10:25
            * @updatehistory:
     *   2019/11/25 10:25 新增
            */
    @GetMapping(value = "/getProportionList")
    public Result<List<FdContractProportion>> getProportion(FdContract fdContract){
        Result<List<FdContractProportion>> result=new Result<>();
        try {
            //判断是什么合同
            if(fdContract.getIsImport().equals("0")){
                //系统合同的金额比例数据
                result.setResult(getProportionList(fdContract.getQuotationId()));
            }else{
                //导入合同的金额比例数据
                LambdaQueryWrapper<FdContractProportion> fdContractProportionLambdaQueryWrapper=new LambdaQueryWrapper<>();
                fdContractProportionLambdaQueryWrapper.eq(FdContractProportion::getContractId,fdContract.getId());
                fdContractProportionLambdaQueryWrapper.orderByAsc(FdContractProportion::getSort);
                List<FdContractProportion> fdContractProportionList=fdContractProportionService.list(fdContractProportionLambdaQueryWrapper);
                //获取合计金额
                Double total=0.00;
                if(!fdContractProportionList.isEmpty()){
                    for(FdContractProportion proportion:fdContractProportionList){
                        total+=Double.parseDouble(proportion.getTotalMoney());
                    }
                }
                FdContractProportion fdContractProportion=new FdContractProportion();
                fdContractProportion.setProportionItem("合计");
                fdContractProportion.setTotalMoney(String.format("%.2f",total));
                fdContractProportion.setProportion("100%");
                fdContractProportionList.add(fdContractProportion);
                result.setResult(fdContractProportionList);
            }
        } catch (Exception e) {
            e.printStackTrace();
            result.error500("操作失败："+e.getMessage());
        }
        return result;
    }

    /***
     * @Title:获取合同比例数据
            * @Description:TODO
            * @param quotationId
            * @return org.jeecg.common.api.vo.Result<java.util.List<org.jeecg.modules.projectManagement.entity.FdContractProportion>>
            * @exception
            * @author 陈创
            * @date 2019/8/27 18:09
            * @updatehistory:
     *   2019/8/27 18:09 查询
            */
    // @GetMapping(value = "/getProportionList")
    public List<FdContractProportion> getProportionList(String quotationId) {
        // Result<List<FdContractProportion>> result = new Result<>();
        LambdaQueryWrapper<fdProjectQuotationFee> fdProjectQuotationFeeLambdaQueryWrapper = new LambdaQueryWrapper<>();
        fdProjectQuotationFeeLambdaQueryWrapper.eq(fdProjectQuotationFee::getDelFlag, "0");
        fdProjectQuotationFeeLambdaQueryWrapper.eq(fdProjectQuotationFee::getProjectQuotationId, quotationId);
        List<fdProjectQuotationFee> fdProjectQuotationFeeList = ifdProjectQuotationFeeService.list(fdProjectQuotationFeeLambdaQueryWrapper);
        //临床空腹总费用-餐后
        Double clinFeeTotal1 = 0.00;
        Double clinFeeTotal2 = 0.00;
        //生物分析空腹总费用-餐后
        Double bioFeeTotal1 = 0.00;
        Double bioFeeTotal2 = 0.00;

        //循环项目报价费用单
        for (fdProjectQuotationFee fee : fdProjectQuotationFeeList) {
            //临床费用
            if (fee.getFeeType().equals("1") || fee.getFeeType().equals("3") || fee.getFeeType().equals("4") ) {
                //空腹
                if (fee.getFeeCategory1SubtotalC() != null && !fee.getFeeCategory1SubtotalC().equals("")) {

                    //小数相加以免出现多位小数
                    // BigDecimal b1 = new BigDecimal(Double.parseDouble(fee.getFeeCategory1Subtotal()));
                    // BigDecimal b2 = new BigDecimal(clinFeeTotal1);
                    clinFeeTotal1 += Double.parseDouble(fee.getFeeCategory1SubtotalC());
                }
                //餐后
                if (fee.getFeeCategory2SubtotalC() != null && !fee.getFeeCategory2SubtotalC().equals("")) {
                    clinFeeTotal2 += Double.parseDouble(fee.getFeeCategory2SubtotalC());
                }
            }
            //生物分析费用
            if (fee.getFeeType().equals("2") || fee.getFeeType().equals("5")|| fee.getFeeType().equals("6")) {
                //空腹
                if (fee.getFeeCategory1SubtotalC() != null && !fee.getFeeCategory1SubtotalC().equals("")) {
                    bioFeeTotal1 += Double.parseDouble(fee.getFeeCategory1SubtotalC());
                }
                //餐后
                if (fee.getFeeCategory2SubtotalC() != null && !fee.getFeeCategory2SubtotalC().equals("")) {
                    bioFeeTotal2 += Double.parseDouble(fee.getFeeCategory2SubtotalC());
                }
            }
        }


        List<FdContractProportion> fdContractProportionList=new ArrayList<>();
        Double clinTotal=clinFeeTotal1+clinFeeTotal2;//临床空腹餐后总计
        Double bioTotal=bioFeeTotal1+bioFeeTotal2;//生物分析临床餐后总计
        String clinPercentage="";//临床百分比
        String bioPercentage="";//生物分析百分比
        //如果临床总计为0
        if(clinTotal==0.00){
            clinPercentage="0.00";
            bioPercentage="100.00";
        }else if(bioTotal==0.00){
            //生物分析总计为0
            clinPercentage="100.00";
            bioPercentage="0.00";
        }else{
            //都不为0则正常计算
            String pro=String.format("%.2f",((clinTotal*100.00)/(clinTotal+bioTotal)));
            clinPercentage=(Double.parseDouble(pro))+"";
            bioPercentage=(100.00-(Double.parseDouble(pro)))+"";
        }
        for(int i=0;i<3;i++){
            FdContractProportion fdContractProportion=new FdContractProportion();
            if(i==0){
                fdContractProportion.setProportionItem("临床项目");
                fdContractProportion.setTotalMoney(String.format("%.2f",clinTotal));
                fdContractProportion.setProportion(String.format("%.2f",Double.parseDouble(clinPercentage))+"%");
            }else if(i==1){
                fdContractProportion.setProportionItem("生物分析");
                fdContractProportion.setTotalMoney(String.format("%.2f",bioTotal));
                fdContractProportion.setProportion(String.format("%.2f",Double.parseDouble(bioPercentage))+"%");
            }else{
                fdContractProportion.setProportionItem("合计");
                fdContractProportion.setTotalMoney(String.format("%.2f",clinTotal+bioTotal));
                fdContractProportion.setProportion("100%");
            }
            fdContractProportionList.add(fdContractProportion);
        }

        // result.setResult(fdContractProportionList);
        return fdContractProportionList;
    }


    //根据来源报价id 获取模板类型为临床项目的在总费用中的比例
    @GetMapping(value = "/listFee1")
    public Result<Map<String, String>> listFee1(String quotation_id) {
        Result<Map<String, String>> result = new Result<>();
        System.out.println(listFee11(quotation_id).get("cost") + "合计");
        System.out.println(listFee11(quotation_id).get("proportion") + "比例");
        result.setResult(listFee11(quotation_id));
        return result;
    }


    //根据来源报价id 获取模板类型为生物分析的在总费用中的比例
    @GetMapping(value = "/listFee2")
    public Result<Map<String, String>> listFee2(String quotation_id) {
        Result<Map<String, String>> result = new Result<>();
        System.out.println(listFee11(quotation_id).get("cost") + "合计2");
        System.out.println(listFee11(quotation_id).get("proportion") + "比例2");
        result.setResult(listFee22(quotation_id));
        return result;
    }

    //将比例设定为 临床项目 和 生物分析 存在数据库里
    public void saveFee1(FdContract fdContract) {
        for (FdContractProportion fdContractProportion : fdContract.getContractProportionList()) {
            if (fdContractProportion.getContractId().equals(fdContract.getId())) {
                if (fdContractProportion.getProportionItem().equals("临床项目")) {
                    Map<String, String> map = listFee11(fdContract.getQuotationId());
                    fdContractProportion.setProportion(map.get("proportion"));
                    fdContractProportion.setTotalMoney(map.get("cost"));
                }
                if (fdContractProportion.getProportionItem().equals("生物分析")) {
                    Map<String, String> map = listFee22(fdContract.getQuotationId());
                    fdContractProportion.setProportion(map.get("proportion"));
                    fdContractProportion.setTotalMoney(map.get("cost"));
                }
            }
        }
        fdContractProportionService.saveBatch(fdContract.getContractProportionList());
    }

    Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");

    //根据来源报价id 获取模板类型为临床项目的在总费用中的比例
    public Map<String, String> listFee11(String quotation_id) {
        //fee11为临床项目费用,fee22为生物分析费用,
        int fee11 = 0;
        int fee22 = 0;
        //根据来源合同id查询项目报价单里的数据
        // LambdaQueryWrapper<FdProjectQuotationTemplateItem> queryWrapper = new LambdaQueryWrapper<>();
        // queryWrapper.eq(FdProjectQuotationTemplateItem::getQuotationId,quotation_id);
        List<FdProjectQuotationTemplateItem> list = fdProjectQuotationTemplateItemService.getItemAndTemp(quotation_id);
        //遍历项目报价单里的数据
        for (FdProjectQuotationTemplateItem fdProjectQuotationTemplateItem : list) {
            //fee1为费用1 fee2为费用2
            int fee1 = 0;
            int fee2 = 0;
            //获得项目报价单模板id
            // String id = fdProjectQuotationTemplateItem.getProjectQuotationTemplateId();
            // FdQuotationTemplate quotationTemplate = fdQuotationTemplateService.getById(id);
            // String type = quotationTemplate.getType();
            String type = fdProjectQuotationTemplateItem.getType();
            //类型转换
            String feeCategory1 = "";
            String feeCategory2 = "";
            if (fdProjectQuotationTemplateItem.getFeeCategory1() != null && !fdProjectQuotationTemplateItem.getFeeCategory1().equals("") && pattern.matcher(fdProjectQuotationTemplateItem.getFeeCategory1()).matches()) {
                feeCategory1 = fdProjectQuotationTemplateItem.getFeeCategory1().replace(" ", "");
            }
            if (fdProjectQuotationTemplateItem.getFeeCategory2() != null && !fdProjectQuotationTemplateItem.getFeeCategory2().equals("") && pattern.matcher(fdProjectQuotationTemplateItem.getFeeCategory2()).matches()) {
                feeCategory2 = fdProjectQuotationTemplateItem.getFeeCategory2().replace(" ", "");
            }
            if (oConvertUtils.isNotEmpty(feeCategory1)) {
                fee1 = Integer.parseInt(feeCategory1);
            }
            if (oConvertUtils.isNotEmpty(feeCategory2)) {
                fee2 = Integer.parseInt(feeCategory2);
            }
            //i是费用1和费用2的和
            int i = fee1 + fee2;
            //根据报价单模板id获取模板类型
            //判断当模板类型为临床项目的时候
            if (type.equals("1") || type.equals("3") || type.equals("4") || type.equals("6")) {
                //获取临床项目的费用
                fee11 = fee11 + i;
            }
            //判断当模板类型为生物分析的时候
            if (type.equals("2") || type.equals("5")) {
                //获取生物分析的费用
                fee22 = fee22 + i;
            }
        }
        // 创建一个数值格式化对象
        NumberFormat numberFormat = NumberFormat.getInstance();
        // 设置精确到小数点后2位
        numberFormat.setMaximumFractionDigits(2);
        String fee3 = "0";
        if ((fee22 + fee11) != 0) {
            fee3 = numberFormat.format((float) fee11 / (float) (fee22 + fee11) * 100) + "%";
        }
        Map<String, String> map = Maps.newHashMap();
        map.put("cost", fee11 + "");
        map.put("proportion", fee3);
        return map;
    }

    //根据来源报价id 获取模板类型为生物分析的在总费用中的比例
    public Map<String, String> listFee22(String quotation_id) {
        //fee1为费用1 fee2为费用2
        int fee1 = 0;
        int fee2 = 0;
        //fee11为临床项目费用,fee22为生物分析费用,
        int fee11 = 0;
        int fee22 = 0;
        //根据来源合同id查询项目报价单里的数据
        // LambdaQueryWrapper<FdProjectQuotationTemplateItem> queryWrapper = new LambdaQueryWrapper<>();
        // queryWrapper.eq(FdProjectQuotationTemplateItem::getQuotationId,quotation_id);
        List<FdProjectQuotationTemplateItem> list = fdProjectQuotationTemplateItemService.getItemAndTemp(quotation_id);
        //遍历项目报价单里的数据
        for (FdProjectQuotationTemplateItem fdProjectQuotationTemplateItem : list) {
            //获得项目报价单模板id
            // String id = fdProjectQuotationTemplateItem.getProjectQuotationTemplateId();
            // FdQuotationTemplate quotationTemplate = fdQuotationTemplateService.getById(id);
            //模板类型
            String type = fdProjectQuotationTemplateItem.getType();
            //类型转换
            String feeCategory1 = "";
            String feeCategory2 = "";
            if (fdProjectQuotationTemplateItem.getFeeCategory1() != null && !fdProjectQuotationTemplateItem.getFeeCategory1().equals("") && pattern.matcher(fdProjectQuotationTemplateItem.getFeeCategory1()).matches()) {
                feeCategory1 = fdProjectQuotationTemplateItem.getFeeCategory1().replace(" ", "");
            }
            if (fdProjectQuotationTemplateItem.getFeeCategory2() != null && !fdProjectQuotationTemplateItem.getFeeCategory2().equals("") && pattern.matcher(fdProjectQuotationTemplateItem.getFeeCategory2()).matches()) {
                feeCategory2 = fdProjectQuotationTemplateItem.getFeeCategory2().replace(" ", "");
            }
            if (oConvertUtils.isNotEmpty(feeCategory1)) {
                fee1 = Integer.parseInt(feeCategory1);
            }
            if (oConvertUtils.isNotEmpty(feeCategory2)) {
                fee2 = Integer.parseInt(feeCategory2);
            }
            //i是费用1和费用2的和
            int i = fee1 + fee2;
            //根据报价单模板id获取模板类型
            //判断当模板类型为临床项目的时候
            if (type.equals("1") || type.equals("3") || type.equals("4") || type.equals("6")) {
                //获取临床项目的费用
                fee11 = fee11 + i;
            }
            //判断当模板类型为生物分析的时候
            if (type.equals("2") || type.equals("5")) {
                //获取生物分析的费用
                fee22 = fee22 + i;
            }
        }
        // 创建一个数值格式化对象
        NumberFormat numberFormat = NumberFormat.getInstance();
        // 设置精确到小数点后2位
        numberFormat.setMaximumFractionDigits(2);
        String fee3 = "0";
        if ((fee22 + fee11) != 0) {
            fee3 = numberFormat.format((float) fee22 / (float) (fee22 + fee11) * 100) + "%";
        }
        Map<String, String> map = Maps.newHashMap();
        map.put("cost", fee22 + "");
        map.put("proportion", fee3);
        return map;
    }

}

