| | |
| | | import com.doumee.dao.admin.request.UpdateCompanySortDTO; |
| | | import com.doumee.dao.admin.response.CompanyDTO; |
| | | import com.doumee.dao.business.MemberMapper; |
| | | import com.doumee.dao.business.YwContractMapper; |
| | | import com.doumee.dao.business.dao.CompanyMapper; |
| | | import com.doumee.dao.business.dao.join.CompanyJoinMapper; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.model.YwContract; |
| | | import com.doumee.dao.business.vo.CompanyTree; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.CompanyService; |
| | |
| | | |
| | | @Autowired |
| | | private CompanyJoinMapper companyJoinMapper; |
| | | @Autowired |
| | | private YwContractMapper ywContractMapper; |
| | | |
| | | |
| | | /** |
| | | * 创建财务公司 |
| | |
| | | .eq(Company::getType,company.getType()) |
| | | .eq(Company::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,名称不能重复~"); |
| | | } |
| | | if(StringUtils.isNotBlank(company.getCode())){ |
| | | if(companyMapper.selectCount(new QueryWrapper<Company>().lambda() |
| | | .eq(Company::getCode,company.getCode()) |
| | | .eq(Company::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,纳税识别号不能重复~"); |
| | | } |
| | | } |
| | | company.setCreateDate(new Date()); |
| | | company.setCreator(company.getLoginUserInfo().getId()); |
| | |
| | | .eq(Company::getName,company.getName()) |
| | | .eq(Company::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,组织名称不能重复~"); |
| | | } |
| | | if(StringUtils.isNotBlank(company.getCode())){ |
| | | if(companyMapper.selectCount(new QueryWrapper<Company>().lambda() |
| | | .eq(Company::getCode,company.getCode()) |
| | | .eq(Company::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,纳税识别号不能重复~"); |
| | | } |
| | | } |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(user ==null){ |
| | |
| | | .eq(Member::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "对不起,该部门下存在人员信息,不能进行删除操作!"); |
| | | } |
| | | if(ywContractMapper.selectCount(new QueryWrapper<YwContract>().lambda().eq(YwContract::getCompanyId,id))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "当前公司已关联业务,不可删除"); |
| | | } |
| | | |
| | | Company company = new Company(); |
| | | company.setId(id); |
| | |
| | | .eq(Company::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,组织名称不能重复~"); |
| | | } |
| | | if(StringUtils.isNotBlank(company.getCode())){ |
| | | if(companyMapper.selectCount(new QueryWrapper<Company>().lambda() |
| | | .eq(Company::getCode,company.getCode()) |
| | | .ne(Company::getId,company.getId()) |
| | | .eq(Company::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,纳税识别号不能重复~"); |
| | | } |
| | | } |
| | | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(user == null){ |
| | | user = company.getLoginUserInfo(); |
| | |
| | | .eq(Company::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,名称不能重复~"); |
| | | } |
| | | if(StringUtils.isNotBlank(company.getCode())){ |
| | | if(companyMapper.selectCount(new QueryWrapper<Company>().lambda() |
| | | .eq(Company::getCode,company.getCode()) |
| | | .ne(Company::getId,company.getId()) |
| | | .eq(Company::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,纳税识别号不能重复~"); |
| | | } |
| | | } |
| | | companyMapper.updateById(company); |
| | | return company.getId(); |
| | | } |
| | |
| | | return companyMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Company> listForConstract(Company company) { |
| | | MPJLambdaWrapper<Company> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(Company.class); |
| | | queryWrapper.like(company.getName() != null,Company::getName, company.getName()); |
| | | queryWrapper.eq(Company::getType, Constants.TWO); |
| | | queryWrapper.eq(Company::getIsdeleted, Constants.ZERO); |
| | | queryWrapper.exists("select b.id from yw_account b where b.isdeleted=0 and b.company_id=t.id and b.status=0"); |
| | | queryWrapper.orderByDesc(Company::getCreateDate); |
| | | return companyMapper.selectList(queryWrapper); |
| | | } |
| | | @Override |
| | | public List<Company> findList(Company company) { |
| | | MPJLambdaWrapper<Company> queryWrapper = new MPJLambdaWrapper<>(); |
| | |
| | | queryWrapper.le(Company::getFsDate, Utils.Date.getEnd(pageWrap.getModel().getFsDate())); |
| | | } |
| | | queryWrapper.orderByDesc(Company::getCreateDate); |
| | | queryWrapper.leftJoin("company t1 on t1.id=t.parant_id"); |
| | | queryWrapper.leftJoin("company t1 on t1.id=t.parent_id"); |
| | | queryWrapper.selectAll(Company.class) |
| | | .select("(select count(m.id) from member m where m.COMPANY_ID=t.id and m.ISDELETED=0) ",Company::getCountNum) |
| | | .select("(select count(m.id) from yw_account m where m.COMPANY_ID=t.id and m.ISDELETED=0)",Company::getAccountNum) ; |
| | |
| | | |
| | | @Override |
| | | public void updateStatusById(Company company) { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | LoginUserInfo loginUserInfo = company.getLoginUserInfo(); |
| | | if(loginUserInfo==null){ |
| | | loginUserInfo = company.getLoginUserInfo(); |
| | | } |