jiangping
2025-06-17 63aab08cd422e940bf27a6908acd0e93a4df3a5c
server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -12,6 +12,7 @@
import com.doumee.dao.business.join.SolutionWorktypeJoinMapper;
import com.doumee.dao.business.join.SolutionsJoinMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.CompanyService;
import com.doumee.service.business.SolutionsService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -56,14 +57,16 @@
    private CompanySolutionMapper companySolutionMapper;
    @Autowired
    private DuSolutionMapper duSolutionMapper;
    @Autowired
    private SolutionsBaseMapper solutionsBaseMapper;
    @Autowired
    private InsuranceApplyMapper insuranceApplyMapper;
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public Integer create(Solutions solutions) {
        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
        initCreateParam(solutions);//工种数据有效性检验,去除空白行数据
        if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda()
                .eq(Solutions::getName,solutions.getName())
                .eq(Solutions::getIsdeleted,Constants.ZERO)
@@ -71,13 +74,35 @@
        )>Constants.ZERO){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"保险方案名称已存在");
        }
        SolutionsBase solutionsBase = solutionsBaseMapper.selectById(solutions.getParentId());
        if(Objects.isNull(solutionsBase)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到主方案数据!");
        }
        solutions.setInsuranceId(solutionsBase.getInsuranceId());
//        solutions.setCanAdd(solutionsBase.getCanAdd());
//        solutions.setCanReduce(solutionsBase.getCanReduce());
//        solutions.setCanChangeUnit(solutionsBase.getCanChangeUnit());
//        solutions.setDelOnlyReplace(solutionsBase.getDelOnlyReplace());
        solutions.setAddValidDays(solutionsBase.getAddValidDays());
        solutions.setDelValidDays(solutionsBase.getDelValidDays());
        solutions.setMinAge(solutionsBase.getMinAge());
        solutions.setMaxAge(solutionsBase.getMaxAge());
        solutions.setSpecialInfo(solutionsBase.getSpecialInfo());
        solutions.setSpecialAgreement(solutionsBase.getSpecialAgreement());
        solutions.setOrtherInfo(solutionsBase.getOrtherInfo());
        solutions.setValidType(solutionsBase.getValidType());
        solutions.setValidTypeNum(solutionsBase.getValidTypeNum());
        solutions.setIsdeleted(Constants.ZERO);
        solutions.setCreator(user.getId());
        solutions.setCreateDate(new Date());
        solutions.setVersion(UUID.randomUUID().toString());//版本号
        solutions.setDataType(Constants.ZERO);
        solutions.setStatus(Constants.ZERO);
        solutions.setCorrectWarnTime(solutionsBase.getCorrectWarnTime());
        //2024年6月17日15:56:18 仅支持替换模式下,批增日期 等于 批减日期
        if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE)){
            solutions.setAddValidDays(solutions.getDelValidDays());
        }
        solutionsMapper.insert(solutions);//基础版本
        //如果有工种,则产生一个新的有效历史版本 ~
@@ -88,24 +113,59 @@
        newModel.setDataType(Constants.TWO);
        solutionsMapper.insert(newModel);
        dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),true);
        if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){
           if  (solutions.getFanganFile()==null || StringUtils.isBlank(solutions.getFanganFile().getFileurl())){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"请上传方案确认书!");
            }
        List<SolutionWorktype> worktypes = solutionWorktypeJoinMapper.selectList(
                new QueryWrapper<SolutionWorktype>().lambda()
                .eq(SolutionWorktype::getSolutionId,solutionsBase.getId())
                .eq(SolutionWorktype::getType,Constants.ONE)
                .eq(SolutionWorktype::getIsdeleted,Constants.ZERO)
        );
            Multifile file = solutions.getFanganFile();
            file.setIsdeleted(Constants.ZERO);
            file.setCreateDate(new Date());
            file.setCreator(user.getId());
            file.setObjId(solutions.getId());
            file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
            file.setType(Constants.formatIntegerNum(file.getType()));
            multifileMapper.insert(file);
           file.setObjId(newModel.getId());
            multifileMapper.insert(file);
        dealWorkType(solutions,newModel,worktypes);
        if  (solutions.getFanganFile()==null || StringUtils.isBlank(solutions.getFanganFile().getFileurl())){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"请上传方案确认书!");
        }
        Multifile file = solutions.getFanganFile();
        file.setIsdeleted(Constants.ZERO);
        file.setCreateDate(new Date());
        file.setCreator(user.getId());
        file.setObjId(solutions.getId());
        file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
        file.setType(Constants.formatIntegerNum(file.getType()));
        multifileMapper.insert(file);
        file.setId(null);
        file.setObjId(newModel.getId());
        multifileMapper.insert(file);
        return solutions.getId();
    }
    private void dealWorkType(Solutions solutions, Solutions newModel, List<SolutionWorktype> worktypes) {
        int num =0;
        List<SolutionWorktype> typeList = new ArrayList<>();
        for(SolutionWorktype type : worktypes) {
            //基础版本
            SolutionWorktype w = new SolutionWorktype();
            w.setSolutionId(solutions.getId());
            w.setIsdeleted(Constants.ZERO);
            w.setCreator(newModel.getCreator());
            w.setCreateDate(solutions.getCreateDate());
            w.setWorktypeId(type.getWorktypeId());
            w.setStatus(Constants.ZERO);
            w.setType(Constants.ZERO);
            w.setSortnum(num++);
            solutionWorktypeJoinMapper.insert(w);
            //历史版本的工种信息
            SolutionWorktype newType = new SolutionWorktype();
            BeanUtils.copyProperties(w, newType);
            newType.setId(null);
            newType.setSolutionId(newModel.getId());
            typeList.add(newType);
        }
        if(typeList.size()>0){
            solutionWorktypeJoinMapper.insert(typeList);
        }
    }
    private void dealWorkType(Solutions solutions, Solutions newModel, List<Integer> worktypeIdList, boolean b) {
@@ -143,22 +203,27 @@
            newType.setSolutionId(newModel.getId());
            solutionWorktypeJoinMapper.insert(newType);
        }
    }
    private void initCreateParam(Solutions solutions) {
        if(StringUtils.isBlank(solutions.getName())
                ||solutions.getInsuranceId()==null
                ||solutions.getWorktypeIdList()==null
                ||solutions.getWorktypeIdList().size()==0
                ||Constants.formatIntegerNum(solutions.getMaxAge()) < 0
                ||Constants.formatIntegerNum(solutions.getMinAge()) < 0
                ||Objects.isNull(solutions.getParentId())
                ||Objects.isNull(solutions.getType())
                ||Objects.isNull(solutions.getRetrial())
                ||Objects.isNull(solutions.getFanganFile())
               || Objects.isNull(solutions.getCanAdd())
                || Objects.isNull(solutions.getCanReduce())
                || Objects.isNull(solutions.getCanChangeUnit())
                || Objects.isNull(solutions.getDelOnlyReplace())
//                ||Constants.formatIntegerNum(solutions.getPriceCycleUnit()) < 0
                ||Constants.formatIntegerNum(solutions.getInsureCycle()) < 0
                ||Constants.formatIntegerNum(solutions.getInsureCycleUnit()) < 0
                || solutions.getMinAge() >solutions.getMaxAge()
                || Constants.formatBigdecimal(solutions.getPrice()).compareTo(new BigDecimal(0)) !=1
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        //委托投保加签方式
        if(Constants.equalsInteger(solutions.getType(),Constants.ONE) && (  Objects.isNull(solutions.getSignType()) || Objects.isNull(solutions.getShopId()))){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
@@ -166,7 +231,22 @@
    @Override
    public void deleteById(Integer id) {
        solutionsMapper.deleteById(id);
        //查询是否已存在使用中的保单
        if(insuranceApplyMapper.selectCount(new QueryWrapper<InsuranceApply>().lambda()
                .apply(" solution_id in (  select id from solutions where BASE_ID = "+id+" or id = "+id+"  )" )
                .notIn(InsuranceApply::getStatus
                        ,Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey()
                        ,Constants.InsuranceApplyStatus.CLOSE.getKey()
                        ,Constants.InsuranceApplyStatus.WTB_CLOSED.getKey()
                )
        )>Constants.ZERO){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在已投保的保单数据,无法进行删除");
        };
        solutionsMapper.update(null,new UpdateWrapper<Solutions>()
                .lambda()
                .set(Solutions::getIsdeleted,Constants.ONE)
                .and(i->i.eq(Solutions::getId,id).or().eq(Solutions::getBaseId,id))
        );
    }
    @Override
@@ -194,6 +274,20 @@
        }
        //数据有效性校验
        initCreateParam(solutions);
        //查询是否已存在使用中的保单
        if(insuranceApplyMapper.selectCount(new QueryWrapper<InsuranceApply>().lambda()
                .apply(" solution_id in (  select id from solutions where BASE_ID = "+solutions.getId()+" or id = "+solutions.getId()+"  )" )
                .notIn(InsuranceApply::getStatus
                        ,Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey()
                        ,Constants.InsuranceApplyStatus.CLOSE.getKey()
                        ,Constants.InsuranceApplyStatus.WTB_CLOSED.getKey()
                )
        )>Constants.ZERO){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在已投保的保单数据,无法进行修改");
        };
        solutions.setType(null);//不支持修改投保方案
        if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda()
                .eq(Solutions::getName,solutions.getName())
                .eq(Solutions::getIsdeleted,Constants.ZERO)
@@ -205,6 +299,7 @@
        solutions.setEditor(user.getId());
        solutions.setVersion(UUID.randomUUID().toString());
        solutions.setEditDate(new Date());
        solutionsMapper.updateById(solutions);
        Solutions oldVersion = solutionsMapper.selectOne(new QueryWrapper<Solutions>()
@@ -213,7 +308,6 @@
                .eq(Solutions::getDataType,Constants.TWO)
                .last("limit 1")
        );
        if(Objects.isNull(oldVersion)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到历史版本数据");
@@ -229,33 +323,9 @@
        newModel.setDataType(Constants.TWO);
        solutionsMapper.insert(newModel);
        //删除所有工种数据
        solutionWorktypeJoinMapper.delete(new UpdateWrapper<SolutionWorktype>()
                .lambda()
                .eq(SolutionWorktype::getSolutionId,solutions.getId())
        );
        if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){
            if  (solutions.getFanganFile()!=null && StringUtils.isNotBlank(solutions.getFanganFile().getFileurl())){
                multifileMapper.update(null,new UpdateWrapper<Multifile>().lambda()
                                .set(Multifile::getIsdeleted,Constants.ONE)
                                .set(Multifile::getEditDate,solutions.getEditDate())
                                .set(Multifile::getEditor,solutions.getEditor())
                                .eq(Multifile::getObjId,solutions.getId())
                                .eq(Multifile::getIsdeleted,Constants.ZERO)
                                .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()));
                Multifile file = solutions.getFanganFile();
                file.setIsdeleted(Constants.ZERO);
                file.setCreateDate(solutions.getEditDate());
                file.setCreator(solutions.getEditor());
                file.setObjId(solutions.getId());
                file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
                file.setType(Constants.formatIntegerNum(file.getType()));
                multifileMapper.insert(file);
                file.setObjId(newModel.getId());
                multifileMapper.insert(file);
            }
        }
        /**
         * 修改当前的启用方案为历史方案
         */
        solutionsMapper.update(null,new UpdateWrapper<Solutions>()
                .lambda()
                .ne(Solutions::getId,newModel.getId())
@@ -264,8 +334,44 @@
                .set(Solutions::getDataType,Constants.ONE)
                .set(StringUtils.isNotBlank(solutions.getSignKeyword()),Solutions::getSignKeyword,solutions.getSignKeyword())
        );
        //处理工种信息,新增最新的,同时产生历史版本
        dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),false);
        if  (solutions.getFanganFile()==null || StringUtils.isBlank(solutions.getFanganFile().getFileurl())){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"请上传方案确认书!");
        }
        multifileMapper.update(null,new UpdateWrapper<Multifile>().lambda()
                        .set(Multifile::getIsdeleted,Constants.ONE)
                        .set(Multifile::getEditDate,solutions.getEditDate())
                        .set(Multifile::getEditor,solutions.getEditor())
                        .eq(Multifile::getObjId,solutions.getId())
                        .eq(Multifile::getIsdeleted,Constants.ZERO)
                        .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()));
        Multifile file = solutions.getFanganFile();
        file.setId(null);
        file.setIsdeleted(Constants.ZERO);
        file.setCreateDate(solutions.getEditDate());
        file.setCreator(solutions.getEditor());
        file.setObjId(solutions.getId());
        file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
        file.setType(Constants.formatIntegerNum(file.getType()));
        multifileMapper.insert(file);
        file.setId(null);
        file.setObjId(newModel.getId());
        multifileMapper.insert(file);
        //删除所有工种数据
        solutionWorktypeJoinMapper.delete(new UpdateWrapper<SolutionWorktype>()
                .lambda()
                .eq(SolutionWorktype::getSolutionId,solutions.getId())
        );
        List<SolutionWorktype> worktypes = solutionWorktypeJoinMapper.selectList(
                new QueryWrapper<SolutionWorktype>().lambda()
                        .eq(SolutionWorktype::getSolutionId,solutions.getParentId())
                        .eq(SolutionWorktype::getType,Constants.ONE)
                        .eq(SolutionWorktype::getIsdeleted,Constants.ZERO)
        );
        dealWorkType(solutions,newModel,worktypes);
        //更新company_solution 使用新版本的数据
        companySolutionMapper.update(null,
@@ -325,8 +431,11 @@
        queryWrapper.selectAll(Solutions.class);
        queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName);
        queryWrapper.selectAs(Company::getName,Solutions::getShopName);
        queryWrapper.selectAs(SolutionsBase::getName,Solutions::getSolutionBaseName);
        queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId);
        queryWrapper.leftJoin(Company.class,Company::getId,Solutions::getShopId);
        queryWrapper.leftJoin(SolutionsBase.class,SolutionsBase::getId,Solutions::getParentId);
        queryWrapper.eq(Solutions::getId,id);
        Solutions model = solutionsJoinMapper.selectJoinOne(Solutions.class,queryWrapper);
        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
@@ -362,37 +471,69 @@
    @Override
    public List<Solutions> findList(Solutions solutions) {
        LoginUserInfo user = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
        solutions.setIsdeleted(Constants.ZERO);
        solutions.setStatus(Constants.ZERO);
        solutions.setStatus(Objects.nonNull(solutions.getStatus())?solutions.getStatus():null);
        if(solutions.getDataType() == null){
            solutions.setDataType(Constants.TWO);
        }
        QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions);
        if(Constants.equalsObject(user.getType(),Constants.TWO)){
            //如果是删除
//                wrapper.lambda().exists("select c.id from company_solution c left join solutions d on c.solution_id=d.id where c.isdeleted=0 and d.base_id=solutions.base_id and c.shop_id="+user.getCompanyId());//设置无效访问
                wrapper.apply("((solutions.type=0 and exists(select cs.id from company_solution cs left join solutions s on cs.solution_id=s.id " +
                        " where cs.isdeleted=0 and cs.SIGN_STATUS = 1  and s.base_id=solutions.base_id and cs.shop_id="+user.getCompanyId()+")) or (" +
                        "solutions.type=1 and solutions.shop_id="+user.getCompanyId()+"))") ;
        }
        return solutionsMapper.selectList(wrapper);
    }
  
    @Override
    public PageData<Solutions> findPage(PageWrap<Solutions> pageWrap) {
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        IPage<Solutions> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        Utils.MP.blankToNull(pageWrap.getModel());
        pageWrap.getModel().setDataType(Constants.ZERO);//只选择基表数据
        pageWrap.getModel().setIsdeleted(Constants.ZERO);
        MPJLambdaWrapper<Solutions> queryWrapper = new MPJLambdaWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        queryWrapper.selectAll(Solutions.class);
        queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName);
        queryWrapper.selectAs(Company::getName,Solutions::getShopName);
        queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId);
        queryWrapper.leftJoin(Company.class,Company::getId,Solutions::getShopId);
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(user.getType().equals(Constants.ONE)){
            queryWrapper.exists(("select 1 from company_solution b where b.isdeleted=0 and b.company_id="+user.getCompanyId()+" and b.SOLUTION_BASE_ID = t.id"));
            queryWrapper.selectAll(Solutions.class);
            queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName);
            queryWrapper.selectAs(Company::getName,Solutions::getShopName);
            queryWrapper.selectAs(SolutionsBase::getName,Solutions::getSolutionBaseName);
            queryWrapper.selectAs(CompanySolution::getSignDate,Solutions::getSignDate);
            queryWrapper.selectAs(CompanySolution::getSignStatus,Solutions::getSignStatus);
            queryWrapper.selectAs(CompanySolution::getFileSignUrl,Solutions::getFileSignUrl);
            queryWrapper.selectAs(CompanySolution::getId,Solutions::getCompanySolutionId);
            queryWrapper.selectAs(SystemUser::getRealname,Solutions::getSignUserName);
            queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId);
            queryWrapper.leftJoin(Company.class,Company::getId,Solutions::getShopId);
            queryWrapper.leftJoin(SolutionsBase.class,SolutionsBase::getId,Solutions::getParentId);
            queryWrapper.leftJoin(CompanySolution.class,CompanySolution::getSolutionBaseId,Solutions::getId);
            queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,CompanySolution::getSignUserId);
            queryWrapper.eq(CompanySolution::getCompanyId,user.getCompanyId());
            queryWrapper.eq(CompanySolution::getIsdeleted,Constants.ZERO);
        }else{
            queryWrapper.selectAll(Solutions.class);
            queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName);
            queryWrapper.selectAs(Company::getName,Solutions::getShopName);
            queryWrapper.selectAs(SolutionsBase::getName,Solutions::getSolutionBaseName);
            queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId);
            queryWrapper.leftJoin(Company.class,Company::getId,Solutions::getShopId);
            queryWrapper.leftJoin(SolutionsBase.class,SolutionsBase::getId,Solutions::getParentId);
        }
        if (pageWrap.getModel().getId() != null) {
            queryWrapper.eq(Solutions::getId, pageWrap.getModel().getId());
        }
        if (pageWrap.getModel().getCreator() != null) {
            queryWrapper.eq(Solutions::getCreator, pageWrap.getModel().getCreator());
        }
        if (pageWrap.getModel().getSignStatus() != null) {
            queryWrapper.eq(CompanySolution::getSignStatus, pageWrap.getModel().getSignStatus());
        }
        if (pageWrap.getModel().getCreateDate() != null) {
            queryWrapper.ge(Solutions::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
@@ -465,6 +606,9 @@
        if (pageWrap.getModel().getOrtherInfo() != null) {
            queryWrapper.eq(Solutions::getOrtherInfo, pageWrap.getModel().getOrtherInfo());
        }
        if (pageWrap.getModel().getParentId() != null) {
            queryWrapper.eq(Solutions::getParentId, pageWrap.getModel().getParentId());
        }
        if (pageWrap.getModel().getVersion() != null) {
            queryWrapper.eq(Solutions::getVersion, pageWrap.getModel().getVersion());
@@ -475,14 +619,22 @@
        if (pageWrap.getModel().getBaseId() != null) {
            queryWrapper.eq(Solutions::getBaseId, pageWrap.getModel().getBaseId());
        }
        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
                queryWrapper.orderByDesc(sortData.getProperty());
            } else {
                queryWrapper.orderByAsc(sortData.getProperty());
        queryWrapper.orderByDesc(Solutions::getCreateDate);
//        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
//            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
//                queryWrapper.orderByDesc(sortData.getProperty());
//            } else {
//                queryWrapper.orderByAsc(sortData.getProperty());
//            }
//        }
        String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+
                systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
        PageData<Solutions> pageData = PageData.from(solutionsJoinMapper.selectJoinPage(page,Solutions.class, queryWrapper));
        for (Solutions solutions:pageData.getRecords()) {
            if(StringUtils.isNotBlank(solutions.getFileSignUrl())){
                solutions.setFileSignUrl(path +solutions.getFileSignUrl());
            }
        }
        PageData<Solutions> pageData = PageData.from(solutionsJoinMapper.selectJoinPage(page,Solutions.class, queryWrapper));
        return pageData;
    }
@@ -524,6 +676,7 @@
                .leftJoin(CompanySolution.class,CompanySolution::getSolutionId,Solutions::getId)
                .leftJoin(Company.class,Company::getId,CompanySolution::getCompanyId)
                .leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId)
                .leftJoin(SolutionsBase.class,SolutionsBase::getId,Solutions::getParentId)
                .eq(Solutions::getIsdeleted,Constants.ZERO)
                .eq(Solutions::getStatus,Constants.ZERO)
                .eq(Solutions::getDataType,dataType)
@@ -533,10 +686,57 @@
                .eq(Company::getStatus,Constants.ZERO)
                .eq(Insurance::getIsdeleted,Constants.ZERO)
                .eq(Insurance::getStatus,Constants.ZERO)
                .orderByAsc(Solutions::getSortnum)
                .eq(SolutionsBase::getStatus,Constants.ZERO)
                .eq(SolutionsBase::getIsdeleted,Constants.ZERO)
                .orderByDesc(Solutions::getCreateDate)
        );
        return solutionsList;
    }
    /**
     * 查询企业已签署的方案信息
     * @param dataType
     * @param companyId
     * @return
     */
    @Override
    public List<Solutions> findListByCompanyId(Integer dataType,Integer companyId) {
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
//        List<Solutions> solutionsList = solutionsJoinMapper.selectJoinList(Solutions.class,new MPJLambdaWrapper<Solutions>()
//                .selectAll(Solutions.class)
//                .leftJoin(CompanySolution.class,CompanySolution::getSolutionId,Solutions::getId)
//                .leftJoin(Company.class,Company::getId,CompanySolution::getCompanyId)
//                .leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId)
//                .leftJoin(SolutionsBase.class,SolutionsBase::getId,Solutions::getParentId)
//                .eq(Solutions::getIsdeleted,Constants.ZERO)
//                .eq(Solutions::getStatus,Constants.ZERO)
//                .eq(Solutions::getDataType,dataType)
//                .eq(CompanySolution::getIsdeleted,Constants.ZERO)
//                .eq(Company::getIsdeleted,Constants.ZERO)
//                .eq(Company::getStatus,Constants.ZERO)
//                .eq(Insurance::getIsdeleted,Constants.ZERO)
//                .eq(Insurance::getStatus,Constants.ZERO)
//                .eq(SolutionsBase::getStatus,Constants.ZERO)
//                .eq(SolutionsBase::getIsdeleted,Constants.ZERO)
//                .eq(CompanySolution::getCompanyId,companyId)
//                .eq(CompanySolution::getSignStatus,Constants.ONE)
//                .orderByDesc(Solutions::getCreateDate)
//        );
        List<Solutions> solutionsList = solutionsJoinMapper.selectJoinList(Solutions.class,new MPJLambdaWrapper<Solutions>()
                .selectAll(Solutions.class)
                .leftJoin(CompanySolution.class,CompanySolution::getSolutionId,Solutions::getId)
                .eq(Solutions::getIsdeleted,Constants.ZERO)
                .eq(Solutions::getStatus,Constants.ZERO)
                .eq(Solutions::getDataType,dataType)
                .eq(CompanySolution::getIsdeleted,Constants.ZERO)
                .eq(CompanySolution::getCompanyId,companyId)
                .eq(CompanySolution::getSignStatus,Constants.ONE)
                .orderByDesc(Solutions::getCreateDate)
        );
        return solutionsList;
    }
    /**
     * 根据历史版本查询当前最新启用版本
@@ -572,5 +772,18 @@
    }
    @Override
    public BigDecimal testSolutionAddMoney(Integer id, BigDecimal fee, Date start,Date end,Date newDate,Date newEndTime){
        return Constants.addFee(solutionsMapper.selectById(id),fee,start,end,newDate,newEndTime);
    }
    @Override
    public BigDecimal testSolutionReduceMoney(Integer id, BigDecimal fee, Date start,Date end,Date reduceStartTime,Date reduceEndTime){
        return Constants.reduceFee(solutionsMapper.selectById(id),fee,start,end,reduceStartTime,reduceEndTime);
    }
    @Override
    public BigDecimal testSolutionProduceMoney(Integer id, BigDecimal fee, Date start,Date end,Date produceStart){
        return Constants.produceFee(solutionsMapper.selectById(id),fee,start,end,produceStart);
    }
}