nidapeng
2024-05-02 13881163217e95af96be33c6fc5ad7ceed3038ce
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -75,6 +75,9 @@
            throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,组织名称不能重复~");
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(user ==null){
            user = company.getLoginUserInfo();
        }
        String rootOrgId = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_ROOTORG_CODE).getCode();
        company.setHkParentId(rootOrgId);
        if(company.getParentId() !=null){
@@ -160,7 +163,9 @@
    @Override
    public Integer createLaborServices(Company company) {
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(loginUserInfo ==null){
            loginUserInfo = company.getLoginUserInfo();
        }
        checkUnique(company);
        Company insert = new Company();
        insert.setCreator(loginUserInfo.getId());
@@ -184,13 +189,11 @@
    }
    @Override
    public void deleteById(Integer id) {
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
    public void deleteById(Integer id,    LoginUserInfo user ) {
        if(id== null ){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        Company model = findById(id);
        if(model == null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "对不起,组织信息不存在~");
@@ -220,13 +223,13 @@
    }
    @Override
    public void deleteByIdInBatch(List<Integer> ids) {
    public void deleteByIdInBatch(List<Integer> ids,LoginUserInfo user) {
        if (CollectionUtils.isEmpty(ids)) {
            return;
        }
        ids.stream().forEach(s->{
            Company company = new Company();
            deleteById(s);
            deleteById(s,user);
        });
    }
@@ -245,6 +248,9 @@
            throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,组织名称不能重复~");
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(user == null){
            user = company.getLoginUserInfo();
        }
        Company model = findById(company.getId());
        if(model == null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "对不起,组织信息不存在~");
@@ -422,7 +428,9 @@
    @Override
    public void updateStatusById(Company company) {
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(loginUserInfo==null){
            loginUserInfo = company.getLoginUserInfo()
        }
        company.setEditDate(new Date());
        company.setEditor(loginUserInfo.getId());
        company.setStatus(company.getStatus());