package org.jeecg.modules.financeManage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.financeManage.entity.FdIncome;
import org.jeecg.modules.financeManage.entity.FdIncomeItem;
import org.jeecg.modules.financeManage.mapper.FdIncomeItemMapper;
import org.jeecg.modules.financeManage.mapper.FdIncomeMapper;
import org.jeecg.modules.financeManage.service.IFdIncomeItemService;
import org.jeecg.modules.financeManage.service.IFdIncomeService;
import org.jeecg.modules.projectManagement.entity.*;
import org.jeecg.modules.projectManagement.mapper.FdBioanalysisSampleMilestonesItemsMapper;
import org.jeecg.modules.projectManagement.mapper.FdProjectFileMapper;
import org.jeecg.modules.projectManagement.mapper.FdProjectQuotationTemplateItemMapper;
import org.jeecg.modules.projectManagement.service.IFdBioanalysisSampleMilestonesService;
import org.jeecg.modules.projectManagement.service.IFdContractService;
import org.jeecg.modules.projectManagement.service.IFdProjectFileService;
import org.jeecg.modules.projectManagement.service.IFdProjectQuotationTemplateService;
import org.jeecg.modules.system.entity.SysUser;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static org.jeecg.common.util.oConvertUtils.isEmpty;

/**
 * @Description: 收入确认
 * @author： jeecg-boot
 * @date：   2019-12-02
 * @version： V1.0
 */
@Transactional
@Service
public class FdIncomeServiceImpl extends ServiceImpl<FdIncomeMapper, FdIncome> implements IFdIncomeService {

    @Resource
    IFdProjectQuotationTemplateService iFdProjectQuotationTemplateService;
    @Resource
    FdProjectQuotationTemplateItemMapper fdProjectQuotationTemplateItemMapper;
    @Resource
    IFdIncomeService iFdIncomeService;
    @Resource
    IFdIncomeItemService iFdIncomeItemService;
    @Resource
    FdIncomeItemMapper fdIncomeItemMapper;
    @Resource
    FdIncomeMapper fdIncomeMapper;
    @Resource
    FdBioanalysisSampleMilestonesItemsMapper fdBioanalysisSampleMilestonesItemsMapper;
    @Resource
    IFdProjectFileService iFdProjectFileService;
    @Resource
    IFdBioanalysisSampleMilestonesService iFdBioanalysisSampleMilestonesService;
    @Resource
    FdProjectFileMapper fdProjectFileMapper;

    @Resource
    IFdContractService iFdContractService;

    /***
     * @Title:获取生物分析明细与生物分析耗材明细
            * @Description:TODO
            * @param quotationId
            * @return org.jeecg.modules.financeManage.entity.FdIncome
            * @exception 
            * @author 陈创
            * @date 2019/12/2 17:46
            * @updatehistory:
     *   2019/12/2 17:46 新增
            */
    @Override
    public List<FdIncomeItem> getTempItemsByQuotation(String quotationId) {
        //生物分析与生物分析耗材模板明细
        List<FdProjectQuotationTemplateItem> fdProjectQuotationTemplateItemList=fdProjectQuotationTemplateItemMapper.getTempItems(quotationId);
        FdIncome fdIncome=new FdIncome();
        List<FdIncomeItem> fdIncomeItemList=new ArrayList<>();
        if(!fdProjectQuotationTemplateItemList.isEmpty()&&fdProjectQuotationTemplateItemList.size()>0){
            for(FdProjectQuotationTemplateItem fdProjectQuotationTemplateItem:fdProjectQuotationTemplateItemList){
                FdIncomeItem fdIncomeItem=new FdIncomeItem();
                fdIncomeItem.setProjectQuotationTempItemId(fdProjectQuotationTemplateItem.getId());
                fdIncomeItem.setName(fdProjectQuotationTemplateItem.getName());
                fdIncomeItem.setDeliverables(fdProjectQuotationTemplateItem.getDeliverables());
                fdIncomeItem.setCompletionTime(fdProjectQuotationTemplateItem.getTimeline());
                // String tempType=fdProjectQuotationTemplateItem.getType();
                // if(StringUtils.isNotBlank(tempType)&&tempType.equals("5")){
                //
                // }
                fdIncomeItem.setFasting(fdProjectQuotationTemplateItem.getFeeCategory1Contract());
                fdIncomeItem.setAfterMeal(fdProjectQuotationTemplateItem.getFeeCategory2Contract());
                fdIncomeItem.setTempType(fdProjectQuotationTemplateItem.getType());
                fdIncomeItem.setTempName(fdProjectQuotationTemplateItem.getQuotationTemplateName());
                //为空则默认为字符空
                if(StringUtils.isEmpty(fdIncomeItem.getApportionmentMethodOne())){
                    fdIncomeItem.setApportionmentMethodOne("");
                }
                if(StringUtils.isEmpty(fdIncomeItem.getLastPeriodCompleted())){
                    fdIncomeItem.setLastPeriodCompleted("");
                }
                if(StringUtils.isEmpty(fdIncomeItem.getCurrentIssueCompleted())){
                    fdIncomeItem.setCurrentIssueCompleted("");
                }
                //获取化合物名称与基质名称
                String templateName = fdProjectQuotationTemplateItem.getQuotationTemplateName();//报价模板名称
                String[] templateNames = templateName.split("-");
                if(templateNames!=null&&templateNames.length>=2){
                    fdIncomeItem.setCompoundName(templateNames[1]);//化合物名称
                    fdIncomeItem.setMatrixTypeName(templateNames[2]);//基质名称
                }
                //获取完成百分比
                progress(fdIncomeItem);
                fdIncomeItemList.add(fdIncomeItem);
            }
            fdIncome.setFdIncomeItemList(fdIncomeItemList);
        }
        return fdIncomeItemList;
    }

    public void progress(FdIncomeItem fdIncomeItem){
        //需要录入到收入确认的里程碑明细
        List<FdBioanalysisSampleMilestonesItems> fdBioanalysisSampleMilestonesItemsList=fdBioanalysisSampleMilestonesItemsMapper.getMilestonesItemsIsisInputIncome();
        for(FdBioanalysisSampleMilestonesItems bioItems:fdBioanalysisSampleMilestonesItemsList){
            String bioCompoundName="";
            if(StringUtils.isNotBlank(bioItems.getCompoundName())){
                bioCompoundName = bioItems.getCompoundName().trim();//里程碑化合物名称
            }
            String bioMatrixTypeName="";
            if(StringUtils.isNotBlank(bioItems.getMatrixTypeName())){
                bioMatrixTypeName = bioItems.getMatrixTypeName().trim();//里程碑明细基质名称
            }
            String bioName="";
            if(StringUtils.isNotBlank(bioItems.getQuotationBiologicalDetailsName())){
                 bioName = bioItems.getQuotationBiologicalDetailsName().trim();//里程碑中关联的生物分析明细名称
            }

            String incomeCompoundName="";
            if(StringUtils.isNotBlank(fdIncomeItem.getCompoundName())){
                incomeCompoundName = fdIncomeItem.getCompoundName().trim();//收入确认化合物名称
            }
            String incomeMatrixTypeName="";
            if(StringUtils.isNotBlank(fdIncomeItem.getMatrixTypeName())){
                incomeMatrixTypeName = fdIncomeItem.getMatrixTypeName().trim();//收入确认基质名称
            }
            String incomeName="";
            if(StringUtils.isNotBlank(fdIncomeItem.getName())){
                incomeName = fdIncomeItem.getName().trim();//收入确认明细名称
            }
            //找到对应明细获取进度
            if (bioCompoundName.equals(incomeCompoundName) && bioMatrixTypeName.equals(incomeMatrixTypeName) && incomeName.equals(bioName)) {
                fdIncomeItem.setCurrentIssueCompleted("100");

            }
            //获取对应的PI
            if(bioCompoundName.equals(incomeCompoundName) &&bioMatrixTypeName.equals(incomeMatrixTypeName)){
                fdIncomeItem.setPfBioanalysisPiId(bioItems.getInvestigatorId());
                fdIncomeItem.setPfBioanalysisPiName(bioItems.getInvestigatorName());
            }
        }
    }

    /***
     * @Title:新增主表与子表
            * @Description:TODO
            * @param fdIncome
            * @return void
            * @exception 
            * @author 陈创
            * @date 2019/12/2 18:10
            * @updatehistory:
     *   2019/12/2 18:10 新增
            */
    @Override
    public void addIncome(FdIncome fdIncome) {
        //主表数据新增
        iFdIncomeService.save(fdIncome);
        //子表新增
        addIncomeItem(fdIncome);
    }

    /***
     * @Title:收入确认子表新增
            * @Description:TODO
            * @param fdIncome
            * @return void
            * @exception
            * @author 陈创
            * @date 2019/12/4 10:03
            * @updatehistory:
     *   2019/12/4 10:03 新增
            */
    public void addIncomeItem(FdIncome fdIncome){
        //子表数据不为空时
        if(!fdIncome.getFdIncomeItemList().isEmpty()&&fdIncome.getFdIncomeItemList().size()>0){
            Integer sort=1;
            for(FdIncomeItem fdIncomeItem:fdIncome.getFdIncomeItemList()){
                fdIncomeItem.setId(null);
                fdIncomeItem.setCreateBy(null);
                fdIncomeItem.setCreateTime(null);
                fdIncomeItem.setIncomeId(fdIncome.getId());
                fdIncomeItem.setSort(sort);
                sort++;
            }
            iFdIncomeItemService.saveBatch(fdIncome.getFdIncomeItemList());
        }
    }

    /***
     * @Title:修改主表以及子表明细
            * @Description:TODO
            * @param fdIncome
            * @return void
            * @exception
            * @author 陈创
            * @date 2019/12/3 9:52
            * @updatehistory:
     *   2019/12/3 9:52 修改/新增
            */
    @Override
    public void updateIncome(FdIncome fdIncome) {
        //修改主表
        iFdIncomeService.updateById(fdIncome);
        //删除旧明细
        // LambdaQueryWrapper<FdIncomeItem> fdIncomeItemLambdaQueryWrapper=new LambdaQueryWrapper<>();
        // fdIncomeItemLambdaQueryWrapper.eq(FdIncomeItem::getDelFlag,CommonConstant.DEL_FLAG_0);
        // fdIncomeItemLambdaQueryWrapper.eq(FdIncomeItem::getIncomeId,fdIncome.getId());
        // iFdIncomeItemService.remove(fdIncomeItemLambdaQueryWrapper);
        //逻辑删除子表数据
        fdIncomeItemMapper.updateDelFlagByIncomeId(fdIncome.getId());
        //新增子表数据
        addIncomeItem(fdIncome);
    }

    /***
     * @Title:收入确认复制
            * @Description:TODO
            * @param fdIncome
            * @return void
            * @exception 
            * @author 陈创
            * @date 2019/12/4 11:11
            * @updatehistory:
     *   2019/12/4 11:11 新增
            */
    @Override
    public void copyIncome(FdIncome fdIncome) {
        //获取子表数据
        LambdaQueryWrapper<FdIncomeItem> fdIncomeItemLambdaQueryWrapper=new LambdaQueryWrapper<>();
        fdIncomeItemLambdaQueryWrapper.eq(FdIncomeItem::getIncomeId,fdIncome.getId());
        fdIncomeItemLambdaQueryWrapper.eq(FdIncomeItem::getDelFlag,CommonConstant.DEL_FLAG_0);
        fdIncomeItemLambdaQueryWrapper.orderByAsc(FdIncomeItem::getSort);
        List<FdIncomeItem> fdIncomeItemList=iFdIncomeItemService.list(fdIncomeItemLambdaQueryWrapper);
        //新增收入确认
        fdIncome.setId(null);
        fdIncome.setCreateTime(null);
        fdIncome.setCreateBy(null);
        fdIncome.setUpdateBy(null);
        fdIncome.setUpdateTime(null);
        //获取当前月份
        Date date=new Date();
        String month = String.format("%tm", date);//月
        fdIncome.setIncomeDateMonth(month);
        iFdIncomeService.save(fdIncome);
        //子表
        fdIncome.setFdIncomeItemList(fdIncomeItemList);
        //新增子表数据
        addIncomeItem(fdIncome);
    }

    @Override
    public IPage<FdIncome> findByPage(Page<FdIncome> page, QueryWrapper<FdIncome> queryWrapper) {
        return fdIncomeMapper.findByPage(page,queryWrapper);
    }

    @Override
    public FdIncome getFdIncomeData(String contractId) {
        //获取项目档案
//        FdProjectFile fdProjectFile=iFdProjectFileService.getById(projectId);
        FdIncome fdIncome=new FdIncome();
        fdIncome.setPercentageOfCompletion(0.0);
        //获取合同下的生物分析里程碑
        LambdaQueryWrapper<FdBioanalysisSampleMilestones> lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(FdBioanalysisSampleMilestones::getDelFlag,"0");
        lambdaQueryWrapper.eq(FdBioanalysisSampleMilestones::getPkContract,contractId);
        List<FdBioanalysisSampleMilestones> fdBioanalysisSampleMilestonesList=iFdBioanalysisSampleMilestonesService.list(lambdaQueryWrapper);
        if(fdBioanalysisSampleMilestonesList!=null&&fdBioanalysisSampleMilestonesList.size()>0){
            Double  overallProgress=0.00;
            for(FdBioanalysisSampleMilestones fdBioanalysisSampleMilestones:fdBioanalysisSampleMilestonesList){
                overallProgress+=Double.parseDouble(fdBioanalysisSampleMilestones.getOverallProgress());
            }
            fdIncome.setPercentageOfCompletion(overallProgress/2);
        }
        //获取项目档案信息
        FdProjectFile fdProjectFile=new FdProjectFile();
        fdProjectFile.setContractId(contractId);
        List<FdProjectFile> fdProjectFileList=fdProjectFileMapper.getPiFileList(fdProjectFile);
        //档案信息
        if(fdProjectFileList!=null&&fdProjectFileList.size()>0){
            String PfPersonName="";//PI
            String compoundName="";//化合物
            for(FdProjectFile fdProjectFile1:fdProjectFileList){
                //生物分析PI
                if(StringUtils.isNotBlank(fdProjectFile1.getInvestigatorName())){
                    PfPersonName+=fdProjectFile1.getInvestigatorName()+"；";
                }
                //临床PI
                if(StringUtils.isNotBlank(fdProjectFile1.getClinicalPi())){
                    PfPersonName+=fdProjectFile1.getClinicalPiName()+"；";
                }
                //化合物
//                if(StringUtils.isNotBlank(fdProjectFile1.getCompoundNameQuotation())){
                    compoundName=fdProjectFile1.getCompoundNameQuotation();
//                }
                fdIncome.setTaxRate(fdProjectFile1.getTaxRate());
            }
            fdIncome.setPfPersonName(PfPersonName);
            fdIncome.setCompoundName(compoundName);
        }
        return fdIncome;
    }

    @Override
    public void refreshProgress() {
        //查询收入确认主数据
        LambdaQueryWrapper<FdIncome> fdIncomeLambdaQueryWrapper=new LambdaQueryWrapper<>();
        fdIncomeLambdaQueryWrapper.eq(FdIncome::getDelFlag,"0");
        fdIncomeLambdaQueryWrapper.orderByDesc(FdIncome::getCreateTime);
        List<FdIncome> fdIncomeList=fdIncomeMapper.selectList(fdIncomeLambdaQueryWrapper);
        //查询收入确认子表数据
        LambdaQueryWrapper<FdIncomeItem> fdIncomeItemLambdaQueryWrapper=new LambdaQueryWrapper<>();
        fdIncomeItemLambdaQueryWrapper.eq(FdIncomeItem::getDelFlag,"0");
        fdIncomeItemLambdaQueryWrapper.orderByAsc(FdIncomeItem::getSort);
        List<FdIncomeItem> fdIncomeItemList=fdIncomeItemMapper.selectList(fdIncomeItemLambdaQueryWrapper);
        Date date=new Date();//当前时间
        Integer mon=Integer.parseInt(String .format("%tm", date));//月
        Integer day=Integer.parseInt(String .format("%td", date));//日
        //组装主表加子表数据
        if(fdIncomeList!=null&&fdIncomeList.size()>0){
            //循环主表
            for(FdIncome fdIncome:fdIncomeList){
                Integer incomeDateMonth=Integer.parseInt(fdIncome.getIncomeDateMonth());//月份
                boolean isMonth=false;//是否更新上月进度
                if(mon>=incomeDateMonth&&day>25){//大于等于上个月份且是在25号或者25号以后
                    isMonth=true;
                }else if(mon>incomeDateMonth){//大于上月份不管是那一天
                    isMonth=true;
                }
                List<FdIncomeItem> fdIncomeItemListCharld=new ArrayList<>();
                //循环子表
                for(FdIncomeItem fdIncomeItem:fdIncomeItemList){
                    //根据主表id找到子表数据
                    if(fdIncome.getId().equals(fdIncomeItem.getIncomeId())){
                        //如果需要跟新上月数据
                        if(isMonth){
                            fdIncomeItem.setLastPeriodCompleted(fdIncomeItem.getCurrentIssueCompleted());//把本期归属到上期完成
                        }
                        fdIncomeItemListCharld.add(fdIncomeItem);
                    }
                }
                fdIncome.setFdIncomeItemList(fdIncomeItemListCharld);
            }
        }
        //获取最新项目进度
        for(FdIncome fdIncome:fdIncomeList){
            FdContract fdContract=iFdContractService.getById(fdIncome.getContractId());
            //最新历程杯进度
            List<FdIncomeItem> fdIncomeItemListNewest=getTempItemsByQuotation(fdContract.getQuotationId());
            //主表子集数据是否为空
            if(fdIncome.getFdIncomeItemList()!=null&&fdIncome.getFdIncomeItemList().size()>0){
                for(FdIncomeItem fdIncomeItemMain:fdIncome.getFdIncomeItemList()){
                    //最新数据是否为空
                    if(fdIncomeItemListNewest!=null&&fdIncomeItemListNewest.size()>0){
                        for(FdIncomeItem fdIncomeItemNewest:fdIncomeItemListNewest){
                            //找到同一个明细
                            if(fdIncomeItemMain.getProjectQuotationTempItemId().equals(fdIncomeItemNewest.getProjectQuotationTempItemId())){
                                //获取最新进度
                                fdIncomeItemMain.setCurrentIssueCompleted(fdIncomeItemNewest.getCurrentIssueCompleted());
                            }
                        }
                    }
                }
            }
        }
        //根据进度更新收入
        for(FdIncome fdIncome:fdIncomeList){
            //主表子集数据是否为空
            if(fdIncome.getFdIncomeItemList()!=null&&fdIncome.getFdIncomeItemList().size()>0){
                Integer incomeDateMonth=Integer.parseInt(fdIncome.getIncomeDateMonth());//月份
                boolean isMonth=false;//是否更新上月进度
                if(mon>=incomeDateMonth&&day>25){//大于等于上个月份且是在25号或者25号以后
                    isMonth=true;
                }else if(mon>incomeDateMonth){//大于上月份不管是那一天
                    isMonth=true;
                }
                if(isMonth){
                    fdIncome.setIncomeDateMonth(mon+"");//获取更新的月份
                    fdIncome.setAccumulatedIncomeOneLastMonth(fdIncome.getAccumulatedIncomeOne());//更新上月总收入
                }
                //按照交付物确认收入总计
                Double deliverablesIncomeTotal=0.00;
                for(FdIncomeItem fdIncomeItemMain:fdIncome.getFdIncomeItemList()){
                    //找到完成进度为100的
                    if(fdIncomeItemMain.getCurrentIssueCompleted().equals("100")){
                        Double fasting=0.00;//空腹
                        Double afterMeal=0.00;//餐后
                        //是否为空或者数字
                        if(isNumber(fdIncomeItemMain.getFasting())){
                            fasting=Double.parseDouble(fdIncomeItemMain.getFasting());
                        }
                        //是否为空或者数字
                        if(isNumber(fdIncomeItemMain.getAfterMeal())){
                            afterMeal=Double.parseDouble(fdIncomeItemMain.getAfterMeal());
                        }
                        //按照交付物确认收入
                        fdIncomeItemMain.setDeliverablesIncome(String.format("%.2f",(fasting+afterMeal)));
                        deliverablesIncomeTotal+=fasting+afterMeal;
                    }
                }
                fdIncome.setDeliverablesIncomeTotal(deliverablesIncomeTotal);
            }
            //获取相关总计
            getDeliverablesProportionIncomeTotal(fdIncome);
            //把之前的数据变成删除状态
            FdIncome fdIncomeDelete=new FdIncome();
            fdIncomeDelete.setId(fdIncome.getId());
            fdIncomeDelete.setDelFlag("1");
            fdIncomeMapper.updateById(fdIncomeDelete);
            //新增
            fdIncome.setId(null);
            fdIncome.setUpdateTime(new Date());
            SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
            fdIncome.setUpdateBy(user.getUsername());
            addIncome(fdIncome);
        }

    }

    /**
    * @Author chenchuang
    * @Description //TODO 计算相关总计
    * @Date 2020/5/29 18:07
    * @Param [fdIncome]
    * @return void
    */
    public void getDeliverablesProportionIncomeTotal(FdIncome fdIncome){
        //按照交付物价值比例摊销进的累计收入
        String deliverablesProportionIncomeTotal=String.format("%.0f",(fdIncome.getDeliverablesIncomeTotal()/(fdIncome.getBiologicalAnalysisTotal()-fdIncome.getWithoutDeliverablesTotal())));
        fdIncome.setDeliverablesProportionIncomeTotal(Double.parseDouble(deliverablesProportionIncomeTotal));
        //按照交付物价值比例摊销项目管理费进的收入计算
        String deliverablesManagementIncomeTotal=String.format("%.2f",(fdIncome.getProjectManagementTotal()*fdIncome.getDeliverablesProportionIncomeTotal()));
        fdIncome.setDeliverablesManagementIncomeTotal(Double.parseDouble(deliverablesManagementIncomeTotal));
        //最大分摊比例
        if(fdIncome.getFdIncomeItemList()!=null&&fdIncome.getFdIncomeItemList().size()>0){
            Double apportionmentMethodOneMax=0.00;//最大分摊比例
            for(FdIncomeItem fdIncomeItem:fdIncome.getFdIncomeItemList()){
                //判断比例是否为空
                if(isNumber(fdIncomeItem.getApportionmentMethodOne())){
                    Double apportionmentMethodOne=Double.parseDouble(fdIncomeItem.getApportionmentMethodOne());//分摊比例
                    if(apportionmentMethodOne>apportionmentMethodOneMax){
                        apportionmentMethodOneMax=apportionmentMethodOne/100;
                    }
                }
            }
            //实际耗材应予确认的累计金额计算
            String actualConsumablesTotal=String.format("%.2f",(apportionmentMethodOneMax*fdIncome.getConsumablesTotal()));
            fdIncome.setActualConsumablesTotal(Double.parseDouble(actualConsumablesTotal));
        }
        //上海方达生物累计收入
        Double taxRate=0.00;
        if(isNumber(fdIncome.getTaxRate())){
            taxRate=Double.parseDouble(fdIncome.getTaxRate());
        }
        Double accumulatedIncomeOne=fdIncome.getDeliverablesIncomeTotal()+fdIncome.getDeliverablesManagementIncomeTotal()+fdIncome.getActualConsumablesTotal();
        //税费
//        String taxation=String.format("%.2f",(accumulatedIncomeOne)*(taxRate/100));
        //上海方达生物累计收入
//        fdIncome.setAccumulatedIncomeOne(accumulatedIncomeOne+Double.parseDouble(taxation));
        fdIncome.setAccumulatedIncomeOne(accumulatedIncomeOne);
        //方达医药累计收入
        String accumulatedIncomeTwo=String.format("%.2f",(fdIncome.getAccumulatedIncomeOne()*0.97));
        fdIncome.setAccumulatedIncomeTwo(Double.parseDouble(accumulatedIncomeTwo));
    }

    /**
    * @Author chenchuang
    * @Description //TODO 判断是否位数字或者是否为空
    * @Date 2020/5/29 15:11
    * @Param [str]
    * @return boolean
    */
    private boolean isNumber(String str){
            if(isEmpty(str)){
                return false;
              }
            String reg = "\\d+(\\.\\d+)?";
           return str.matches(reg);
    }
}
