| | |
| | | |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.gkhy.exam.common.constant.Constants; |
| | | import com.gkhy.exam.common.constant.UserConstant; |
| | | import com.gkhy.exam.common.domain.TreeSelect; |
| | | import com.gkhy.exam.common.domain.entity.SysDept; |
| | | import com.gkhy.exam.common.domain.entity.SysRole; |
| | | import com.gkhy.exam.common.domain.entity.SysUser; |
| | | import com.gkhy.exam.common.exception.ApiException; |
| | | import com.gkhy.exam.common.utils.SecurityUtils; |
| | | import com.gkhy.exam.common.utils.SpringUtils; |
| | | import com.gkhy.exam.system.domain.ExPaperStudent; |
| | | import com.gkhy.exam.system.domain.SysDeptResponsibility; |
| | | import com.gkhy.exam.system.domain.SysFunctionalDistribution; |
| | | import com.gkhy.exam.system.domain.vo.*; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | |
| | | |
| | | public List<DeptVo> selectDeptList(SysDept dept) |
| | | { |
| | | if (dept.getCompanyId() == null){ |
| | | dept.setCompanyId(SecurityUtils.getCompanyId()); |
| | | } |
| | | return deptMapper.selectDeptList(dept); |
| | | } |
| | | |
| | |
| | | public boolean checkDeptNameUnique(SysDept dept) |
| | | { |
| | | Long deptId = ObjectUtil.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); |
| | | Long companyId = SecurityUtils.getLoginUser().getUser().getCompanyId(); |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | |
| | | SysDept info = deptMapper.checkDeptNameUnique(companyId,dept.getDeptName(), dept.getParentId()); |
| | | if (ObjectUtil.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public int saveDept(SysDeptSaveDTOReq dept) { |
| | | Long companyId = SecurityUtils.getLoginUser().getUser().getCompanyId(); |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | if (!companyId.equals(dept.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public int saveDeptResponsibility(SysDeptResponsibilityReqVo reqVo) { |
| | | Long companyId = SecurityUtils.getLoginUser().getUser().getCompanyId(); |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | if (!companyId.equals(reqVo.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<SysFunctionalDistribution> getFunctionalDistributionList(Long companyId) { |
| | | if (companyId != null){ |
| | | companyId = SecurityUtils.getCompanyId(); |
| | | } |
| | | return sysFunctionalDistributionMapper.selectListVo(companyId); |
| | | } |
| | | |
| | | @Override |
| | | public int initFunctionalDistribution(Long companyId) { |
| | | |
| | | if (!companyId.equals(SecurityUtils.getLoginUser().getUser().getCompanyId())){ |
| | | if (!companyId.equals(SecurityUtils.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | sysFunctionalDistributionMapper.delete(new LambdaQueryWrapper<SysFunctionalDistribution>().eq(SysFunctionalDistribution::getCompanyId, SecurityUtils.getLoginUser().getUser().getCompanyId())); |
| | |
| | | if (emptyIdClauseNumSet.size() != emptyIdClauseNums.size()){ |
| | | throw new ApiException("部门条款编码重复!"); |
| | | } |
| | | List<Long> emptyIdClauseIds = sysDeptResponsibilityList.stream() |
| | | .filter(item -> item.getId() != null) |
| | | .map(SysDeptResponsibility::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!emptyIdClauseNums.isEmpty()){ |
| | | List<SysDeptResponsibility> sysDeptResponsibilities = deptResponsibilityMapper.selectList(new LambdaQueryWrapper<SysDeptResponsibility>() |
| | | .eq(SysDeptResponsibility::getDeptId, reqVo.getDeptId()).in(SysDeptResponsibility::getClauseNum, emptyIdClauseNums)); |
| | | .eq(SysDeptResponsibility::getDeptId, reqVo.getDeptId()).in(SysDeptResponsibility::getClauseNum, emptyIdClauseNums).notIn(SysDeptResponsibility::getId, emptyIdClauseIds)); |
| | | if (!sysDeptResponsibilities.isEmpty()){ |
| | | throw new ApiException("部门条款编码重复!"); |
| | | } |
| | |
| | | .update(new SysDeptResponsibility(), |
| | | new LambdaUpdateWrapper<SysDeptResponsibility>().set(SysDeptResponsibility::getDelFlag, UserConstant.DEPT_DISABLE) |
| | | .set(SysDeptResponsibility::getUpdateTime, LocalDateTime.now()).set(SysDeptResponsibility::getUpdateBy, SecurityUtils.getUsername()) |
| | | .eq(SysDeptResponsibility::getDeptId, deptId)); |
| | | .eq(SysDeptResponsibility::getDeptId, deptId).in(SysDeptResponsibility::getId, delCaluseIds)); |
| | | } |
| | | |
| | | private void batchSaveCaluse(Long deptId,Long companyId, List<CaluseVO1> caluseVO1List) { |
| | |
| | | sysDeptResponsibility.setCompanyId(companyId); |
| | | sysDeptResponsibility.setDeptId(deptId); |
| | | |
| | | |
| | | if (sysDeptResponsibility.getId() == null){ |
| | | sysDeptResponsibility.setCreateBy(SecurityUtils.getUsername()); |
| | | sysDeptResponsibility.setCreateTime(LocalDateTime.now()); |
| | | sysDeptResponsibility.setDataType("2"); |
| | | deptResponsibilityMapper.insert(sysDeptResponsibility); |
| | | }else { |
| | | sysDeptResponsibility.setUpdateBy(SecurityUtils.getUsername()); |