nidapeng
2024-03-20 c9f07c1f79e7ea9eb00925975d3ae2c9e8dcbd25
server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -61,6 +61,15 @@
        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)
                .eq(Solutions::getDataType,Constants.ZERO)
        )>Constants.ZERO){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"保险方案名称已存在");
        }
        solutions.setIsdeleted(Constants.ZERO);
        solutions.setCreator(user.getId());
        solutions.setCreateDate(new Date());
@@ -167,7 +176,14 @@
        }
        //数据有效性校验
        initCreateParam(solutions);
        if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda()
                .eq(Solutions::getName,solutions.getName())
                .eq(Solutions::getIsdeleted,Constants.ZERO)
                .eq(Solutions::getDataType,Constants.ZERO)
                .ne(Solutions::getId,solutions.getId())
        )>Constants.ZERO){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"保险方案名称已存在");
        }
        solutions.setEditor(user.getId());
        solutions.setVersion(UUID.randomUUID().toString());
        solutions.setEditDate(new Date());
@@ -270,7 +286,9 @@
        MPJLambdaWrapper<Solutions> queryWrapper = new MPJLambdaWrapper<>();
        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);
        queryWrapper.eq(Solutions::getId,id);
        Solutions model = solutionsJoinMapper.selectJoinOne(Solutions.class,queryWrapper);
        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
@@ -315,8 +333,13 @@
        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"));
        }
        if (pageWrap.getModel().getId() != null) {
            queryWrapper.eq(Solutions::getId, pageWrap.getModel().getId());
        }
@@ -451,11 +474,17 @@
        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)
                .eq(Solutions::getIsdeleted,Constants.ZERO)
                .eq(Solutions::getStatus,Constants.ZERO)
                .eq(Solutions::getDataType,dataType)
                .eq(CompanySolution::getIsdeleted,Constants.ZERO)
                .eq(CompanySolution::getCompanyId,user.getCompanyId())
                .eq(Company::getIsdeleted,Constants.ZERO)
                .eq(Company::getStatus,Constants.ZERO)
                .eq(Insurance::getIsdeleted,Constants.ZERO)
                .eq(Insurance::getStatus,Constants.ZERO)
                .orderByAsc(Solutions::getSortnum)
        );
        return solutionsList;