| | |
| | | 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){ |
| | |
| | | @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()); |
| | |
| | | } |
| | | |
| | | @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(), "对不起,组织信息不存在~"); |
| | |
| | | } |
| | | |
| | | @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); |
| | | }); |
| | | } |
| | | |
| | |
| | | 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(), "对不起,组织信息不存在~"); |
| | |
| | | @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()); |