| | |
| | | // 更新缓存用户权限 |
| | | LoginUserDetails loginUser = getLoginUser(); |
| | | |
| | | if (ObjectUtil.isNotNull(loginUser.getUser()) && !SecurityUtils.isAdmin(loginUser.getUser().getId())) |
| | | if (ObjectUtil.isNotNull(loginUser.getUser()) && !SecurityUtils.adminUser()) |
| | | { |
| | | loginUser.setUser(userService.selectUserByUsername(loginUser.getUser().getName())); |
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @Api(tags = "企业基础信息管理") |
| | |
| | | |
| | | @Autowired |
| | | private CompanyRosterService companyRosterService; |
| | | |
| | | @Autowired |
| | | private CompanyIndustryTemplateService companyIndustryTemplateService; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 行业模版 |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "行业模版(分页)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"), |
| | | @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"), |
| | | }) |
| | | @GetMapping("/industryTemplate/list") |
| | | public CommonResult selectCompanyIndustryTemplateList(Integer companyId){ |
| | | return CommonResult.success(companyIndustryTemplateService.selectCompanyIndustryTemplateList(companyId)); |
| | | } |
| | | |
| | | /** |
| | | * 行业模版新增 |
| | | * @param companyRoster |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "行业模版新增") |
| | | @PostMapping("/industryTemplate/insert") |
| | | public CommonResult insertCompanyIndustryTemplate(@Validated @RequestBody CompanyIndustryTemplate companyRoster){ |
| | | return companyIndustryTemplateService.insertCompanyIndustryTemplate(companyRoster); |
| | | } |
| | | |
| | | /** |
| | | * 企业花名册修改 |
| | | * @param companyIndustryTemplate |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "行业模版修改") |
| | | @PostMapping("/industryTemplate/update") |
| | | public CommonResult updateCompanyIndustryTemplate(@Validated @RequestBody CompanyIndustryTemplate companyIndustryTemplate){ |
| | | return companyIndustryTemplateService.updateCompanyIndustryTemplate(companyIndustryTemplate); |
| | | } |
| | | |
| | | /** |
| | | * 行业模版删除 |
| | | * @param industryTemplateId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "行业模版删除") |
| | | @GetMapping("/industryTemplate/deleted") |
| | | public CommonResult deletedCompanyIndustryTemplate(@RequestParam("companyRosterId") Integer industryTemplateId){ |
| | | return companyIndustryTemplateService.deletedCompanyIndustryTemplate(industryTemplateId); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | return userId != null && 1L == userId; |
| | | } |
| | | |
| | | public static boolean adminUser(){ |
| | | if(getLoginUser() == null){ |
| | | return false; |
| | | } |
| | | if(getLoginUser().getUser().getId() == 1L){ |
| | | return true; |
| | | } |
| | | if(getLoginUser().getUser().getUserType() == 0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 判断密码是否相同 |
| | | * @param rawPasword 真实密码 |
| | |
| | | { |
| | | Set<String> roles = new HashSet<String>(); |
| | | // 管理员拥有所有权限 |
| | | if (SecurityUtils.isAdmin(user.getId())) |
| | | if (SecurityUtils.adminUser() ) |
| | | { |
| | | roles.add("admin"); |
| | | } |
| | |
| | | { |
| | | Set<String> perms = new HashSet<String>(); |
| | | // 管理员拥有所有权限 |
| | | if (SecurityUtils.isAdmin(user.getId())) |
| | | if (SecurityUtils.adminUser()) |
| | | { |
| | | perms.add("*:*:*"); |
| | | } |
对比新文件 |
| | |
| | | package com.gkhy.exam.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Getter |
| | | @Setter |
| | | @TableName("company_industry_template") |
| | | @ApiModel(value = "company_industry_template",description = "行业模板") |
| | | public class CompanyIndustryTemplate implements Serializable { |
| | | |
| | | @ApiModelProperty("主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @NotNull(message = "企业Id不可为空") |
| | | @ApiModelProperty(value = "企业ID") |
| | | @TableField("company_id") |
| | | private Integer companyId; |
| | | |
| | | @ApiModelProperty(value = "企业名称") |
| | | @TableField("company_name") |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "模板名称") |
| | | @TableField("template_name") |
| | | @NotBlank(message = "模板名称不可为空") |
| | | private String templateName; |
| | | |
| | | @ApiModelProperty(value = "行业类型1化工2安防") |
| | | @TableField("industry_type") |
| | | @NotNull(message = "行业类型不可为空") |
| | | private Integer industryType; |
| | | |
| | | @ApiModelProperty(value = "文件路径") |
| | | @TableField("file_path") |
| | | @NotBlank(message = "文件路径不可为空") |
| | | private String filePath; |
| | | |
| | | @ApiModelProperty(value = "文件格式") |
| | | @TableField("format") |
| | | @NotBlank(message = "文件格式不可为空") |
| | | private String format; |
| | | |
| | | @ApiModelProperty(value = "是否删除") |
| | | @TableField("del_flag") |
| | | private Integer delFlag; |
| | | |
| | | @TableField("create_by") |
| | | private String createBy; |
| | | |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField("update_by") |
| | | private String updateBy; |
| | | |
| | | @TableField("update_time") |
| | | private LocalDateTime updateTime; |
| | | |
| | | |
| | | } |
| | |
| | | @Getter |
| | | @Setter |
| | | @TableName("company_roster") |
| | | @ApiModel(value = "company_roster",description = "员工花名册") |
| | | @ApiModel(value = "company_roster",description = "员工信息") |
| | | public class CompanyRoster implements Serializable { |
| | | |
| | | @ApiModelProperty("主键") |
对比新文件 |
| | |
| | | package com.gkhy.exam.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.gkhy.exam.system.domain.CompanyIndustryTemplate; |
| | | import com.gkhy.exam.system.domain.CompanyRoster; |
| | | import org.mapstruct.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface CompanyIndustryTemplateMapper extends BaseMapper<CompanyIndustryTemplate> { |
| | | List<CompanyIndustryTemplate> selectCompanyIndustryTemplateList(Integer companyId); |
| | | |
| | | int updateCompanyIndustryTemplateById(CompanyIndustryTemplate template); |
| | | } |
| | |
| | | package com.gkhy.exam.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.gkhy.exam.system.domain.Quality; |
| | | import com.gkhy.exam.system.domain.QualityDecompose; |
| | | import com.gkhy.exam.system.domain.req.DecomposeTargetReq; |
| | | import com.gkhy.exam.system.domain.req.QualityReq; |
| | |
| | | |
| | | int insertDecompose(DecomposeTargetReq decomposeTargetReq); |
| | | |
| | | List<Integer> selectByDelFlag(); |
| | | } |
对比新文件 |
| | |
| | | package com.gkhy.exam.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.gkhy.exam.common.api.CommonPage; |
| | | import com.gkhy.exam.common.api.CommonResult; |
| | | import com.gkhy.exam.system.domain.CompanyIndustryTemplate; |
| | | import com.gkhy.exam.system.domain.CompanyRoster; |
| | | |
| | | public interface CompanyIndustryTemplateService extends IService<CompanyIndustryTemplate> { |
| | | CommonPage selectCompanyIndustryTemplateList(Integer companyId); |
| | | |
| | | CommonResult insertCompanyIndustryTemplate(CompanyIndustryTemplate companyIndustryTemplate); |
| | | |
| | | CommonResult updateCompanyIndustryTemplate(CompanyIndustryTemplate companyIndustryTemplate); |
| | | |
| | | CommonResult deletedCompanyIndustryTemplate(Integer companyIndustryTemplateId); |
| | | } |
| | |
| | | @Override |
| | | public CommonPage selectCompanyBasicList(Integer companyId) { |
| | | |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | if (companyId==null){ |
| | | throw new ApiException("非管理员操作,查询条件不可为空"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public CommonPage selectCompanyCertificateList(Integer companyId) { |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | if (companyId==null){ |
| | | throw new ApiException("非管理员操作,查询条件不可为空"); |
| | | } |
对比新文件 |
| | |
| | | package com.gkhy.exam.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.exam.common.api.CommonPage; |
| | | import com.gkhy.exam.common.api.CommonResult; |
| | | import com.gkhy.exam.common.domain.model.LoginUserDetails; |
| | | import com.gkhy.exam.common.exception.ApiException; |
| | | import com.gkhy.exam.common.utils.PageUtils; |
| | | import com.gkhy.exam.common.utils.SecurityUtils; |
| | | import com.gkhy.exam.system.domain.CompanyIndustryTemplate; |
| | | import com.gkhy.exam.system.domain.CompanyRoster; |
| | | import com.gkhy.exam.system.domain.SysCompany; |
| | | import com.gkhy.exam.system.mapper.CompanyIndustryTemplateMapper; |
| | | import com.gkhy.exam.system.mapper.CompanyRosterMapper; |
| | | import com.gkhy.exam.system.service.CompanyIndustryTemplateService; |
| | | import com.gkhy.exam.system.service.SysCompanyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class CompanyIndustryTemplateServiceImpl extends ServiceImpl<CompanyIndustryTemplateMapper, CompanyIndustryTemplate> implements CompanyIndustryTemplateService { |
| | | |
| | | @Autowired |
| | | private CompanyIndustryTemplateMapper companyIndustryTemplateMapper; |
| | | @Autowired |
| | | private SysCompanyService sysCompanyService; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public CommonPage selectCompanyIndustryTemplateList(Integer companyId) { |
| | | boolean admin = SecurityUtils.adminUser(); |
| | | if (!admin){ |
| | | if (companyId==null){ |
| | | throw new ApiException("非管理员操作,查询条件不可为空"); |
| | | } |
| | | } |
| | | PageUtils.startPage(); |
| | | List<CompanyIndustryTemplate> companyIndustryTemplates = companyIndustryTemplateMapper.selectCompanyIndustryTemplateList(companyId); |
| | | return CommonPage.restPage(companyIndustryTemplates); |
| | | } |
| | | |
| | | @Override |
| | | public CommonResult insertCompanyIndustryTemplate(CompanyIndustryTemplate companyIndustryTemplate) { |
| | | LoginUserDetails loginUser = SecurityUtils.getLoginUser(); |
| | | |
| | | SysCompany sysCompany = sysCompanyService.selectCompanyById(SecurityUtils.getCompanyId()); |
| | | companyIndustryTemplate.setCompanyName(sysCompany.getName()); |
| | | companyIndustryTemplate.setCreateBy(loginUser.getUsername()); |
| | | companyIndustryTemplate.setCreateTime(LocalDateTime.now()); |
| | | int insert = companyIndustryTemplateMapper.insert(companyIndustryTemplate); |
| | | if (insert>0){ |
| | | return CommonResult.success(); |
| | | } |
| | | return CommonResult.failed(); |
| | | } |
| | | |
| | | @Override |
| | | public CommonResult updateCompanyIndustryTemplate(CompanyIndustryTemplate companyIndustryTemplate) { |
| | | LoginUserDetails loginUser = SecurityUtils.getLoginUser(); |
| | | SysCompany sysCompany = sysCompanyService.selectCompanyById(SecurityUtils.getCompanyId()); |
| | | companyIndustryTemplate.setCompanyName(sysCompany.getName()); |
| | | companyIndustryTemplate.setUpdateBy(loginUser.getUsername()); |
| | | companyIndustryTemplate.setUpdateTime(LocalDateTime.now()); |
| | | int update = companyIndustryTemplateMapper.updateCompanyIndustryTemplateById(companyIndustryTemplate); |
| | | if (update>0){ |
| | | return CommonResult.success(); |
| | | } |
| | | return CommonResult.failed(); |
| | | } |
| | | |
| | | @Override |
| | | public CommonResult deletedCompanyIndustryTemplate(Integer companyIndustryTemplateId) { |
| | | CompanyIndustryTemplate industryTemplate = new CompanyIndustryTemplate(); |
| | | LoginUserDetails loginUser = SecurityUtils.getLoginUser(); |
| | | industryTemplate.setUpdateBy(loginUser.getUsername()); |
| | | industryTemplate.setUpdateTime(LocalDateTime.now()); |
| | | industryTemplate.setDelFlag(1); |
| | | industryTemplate.setId(companyIndustryTemplateId); |
| | | int i = companyIndustryTemplateMapper.updateById(industryTemplate); |
| | | if (i>0){ |
| | | return CommonResult.success(); |
| | | } |
| | | return CommonResult.failed(); |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private SysCompanyService sysCompanyService; |
| | | |
| | | /** |
| | | * 质量方针列表 |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonPage selectCompanyQualityPolicyList(Integer companyId) { |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | if (companyId==null){ |
| | | throw new ApiException("非管理员操作,查询条件不可为空"); |
| | | } |
| | |
| | | return CommonPage.restPage(companyQualityPolicies); |
| | | } |
| | | |
| | | /** |
| | | * 质量方针新增 |
| | | * @param companyQualityPolicy |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult insertCompanyQualityPolicy(CompanyQualityPolicy companyQualityPolicy) { |
| | | LoginUserDetails loginUser = SecurityUtils.getLoginUser(); |
| | |
| | | return CommonResult.failed(); |
| | | } |
| | | |
| | | /** |
| | | * 质量方针修改 |
| | | * @param companyQualityPolicy |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult updateCompanyQualityPolicy(CompanyQualityPolicy companyQualityPolicy) { |
| | | LoginUserDetails loginUser = SecurityUtils.getLoginUser(); |
| | |
| | | return CommonResult.failed(); |
| | | } |
| | | |
| | | /** |
| | | * 质量方针删除 |
| | | * @param qualityPolicyId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult deletedCompanyQualityPolicy(Integer qualityPolicyId) { |
| | | LoginUserDetails loginUser = SecurityUtils.getLoginUser(); |
| | | //封装删除对象 |
| | | CompanyQualityPolicy companyQualityPolicy = new CompanyQualityPolicy(); |
| | | companyQualityPolicy.setId(qualityPolicyId); |
| | | companyQualityPolicy.setUpdateBy(loginUser.getUsername()); |
| | |
| | | |
| | | @Override |
| | | public CommonPage selectCompanyRosterList(Integer companyId) { |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | boolean admin = SecurityUtils.adminUser(); |
| | | if (!admin){ |
| | | if (companyId==null){ |
| | | throw new ApiException("非管理员操作,查询条件不可为空"); |
| | |
| | | LoginUserDetails loginUser = SecurityUtils.getLoginUser(); |
| | | companyRoster.setUpdateBy(loginUser.getUsername()); |
| | | companyRoster.setUpdateTime(LocalDateTime.now()); |
| | | companyRoster.setDelFlag(2); |
| | | companyRoster.setDelFlag(1); |
| | | companyRoster.setId(companyRosterId); |
| | | int i = companyRosterMapper.updateById(companyRoster); |
| | | if (i>0){ |
| | |
| | | |
| | | @Override |
| | | public CommonPage selectCompanySummaryList(Integer companyId) { |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | if (companyId==null){ |
| | | throw new ApiException("非管理员操作,查询条件不可为空"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<InformationPlatform> getInformationPlatforms(Long companyId) { |
| | | if (companyId == null) { |
| | | companyId = SecurityUtils.getCompanyId(); |
| | | } |
| | | |
| | | LambdaQueryWrapper<InformationPlatform> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(InformationPlatform::getCompanyId, companyId); |
| | | if (companyId != null){ |
| | | queryWrapper.eq(InformationPlatform::getCompanyId, companyId); |
| | | } |
| | | queryWrapper.eq(InformationPlatform::getDelFlag, UserConstant.ENABLE); |
| | | queryWrapper.orderByDesc(InformationPlatform::getCreateTime); |
| | | |
| | |
| | | |
| | | @Override |
| | | public int saveInformationPlatform(InformationPlatform informationPlatform) { |
| | | Long companyId = informationPlatform.getCompanyId(); |
| | | if (!companyId.equals(SecurityUtils.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // Long companyId = informationPlatform.getCompanyId(); |
| | | // if (!companyId.equals(SecurityUtils.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | |
| | | if (informationPlatform.getId() != null){ |
| | | informationPlatform.setUpdateTime(LocalDateTime.now()); |
| | |
| | | |
| | | @Override |
| | | public CommonPage selectQualityAccomplishList(QualityReq qualityReq) { |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | if (qualityReq.getCompanyId()==null){ |
| | | throw new ApiException("非管理员,查询条件不可为空"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public CommonPage selectQualityDecomposeList(QualityReq qualityReq) { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | if (qualityReq.getCompanyId()==null){ |
| | | throw new ApiException("非管理员,查询条件不可为空"); |
| | | } |
| | |
| | | package com.gkhy.exam.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.exam.common.api.CommonPage; |
| | | import com.gkhy.exam.common.api.CommonResult; |
| | |
| | | import com.gkhy.exam.common.exception.ApiException; |
| | | import com.gkhy.exam.common.utils.PageUtils; |
| | | import com.gkhy.exam.common.utils.SecurityUtils; |
| | | import com.gkhy.exam.system.domain.CompanyBasic; |
| | | import com.gkhy.exam.system.domain.Quality; |
| | | import com.gkhy.exam.system.domain.QualityTarget; |
| | | import com.gkhy.exam.system.domain.SysCompany; |
| | | import com.gkhy.exam.system.domain.*; |
| | | import com.gkhy.exam.system.domain.req.QualityTargetReq; |
| | | import com.gkhy.exam.system.domain.vo.QualityTargetVo; |
| | | import com.gkhy.exam.system.mapper.QualityDecomposeMapper; |
| | | import com.gkhy.exam.system.mapper.QualityMapper; |
| | | import com.gkhy.exam.system.mapper.QualityTargetMapper; |
| | | import com.gkhy.exam.system.mapper.SysDeptMapper; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.sql.Wrapper; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | @Autowired |
| | | private QualityTargetMapper qualityTargetMapper; |
| | | @Autowired |
| | | private QualityDecomposeMapper qualityDecomposeMapper; |
| | | @Autowired |
| | | private SysCompanyService sysCompanyService; |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | |
| | | @Override |
| | | public CommonPage selectQualityList(Quality quality) { |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | if (quality.getCompanyId()==null){ |
| | | throw new RuntimeException("非管理员操作,查询条件不可为空"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public int saveSysClauseManagement(SysClauseManagement sysClauseManagement) { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | throw new ApiException("没有权限访问!"); |
| | | } |
| | | LambdaQueryWrapper<SysClauseManagement> lambdaQueryWrapper = Wrappers.<SysClauseManagement>lambdaQuery() |
| | |
| | | |
| | | @Override |
| | | public int delSysClauseManagement(Long id) { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if (!SecurityUtils.adminUser()){ |
| | | throw new ApiException("没有权限访问!"); |
| | | } |
| | | //todo 校验已使用的? |
| | |
| | | @Override |
| | | public void checkDeptDataScope(Long deptId) |
| | | { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && ObjectUtil.isNotNull(deptId)) |
| | | if (!SecurityUtils.adminUser() && ObjectUtil.isNotNull(deptId)) |
| | | { |
| | | SysDept dept = new SysDept(); |
| | | dept.setDeptId(deptId); |
| | |
| | | @Override |
| | | @Transactional |
| | | public int saveDept(SysDeptSaveDTOReq dept) { |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | if (!companyId.equals(dept.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // Long companyId = SecurityUtils.getCompanyId(); |
| | | // if (!companyId.equals(dept.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | SysDept sysDept = new SysDept(); |
| | | BeanUtils.copyProperties(dept, sysDept); |
| | | sysDept.setCompanyId(companyId); |
| | | boolean b = checkDeptNameUnique(sysDept); |
| | | if (!b){ |
| | | throw new ApiException("部门名称已存在!"); |
| | |
| | | delCaluse(sysDept.getDeptId(), delCaluseIds); |
| | | } |
| | | //处理条款 |
| | | batchSaveCaluse(sysDept.getDeptId(), companyId, dept.getCaluseVO1List()); |
| | | batchSaveCaluse(sysDept.getDeptId(), dept.getCompanyId(), dept.getCaluseVO1List()); |
| | | |
| | | } |
| | | |
| | |
| | | @Override |
| | | @Transactional |
| | | public int saveDeptResponsibility(SysDeptResponsibilityReqVo reqVo) { |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | if (!companyId.equals(reqVo.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // Long companyId = SecurityUtils.getCompanyId(); |
| | | // if (!companyId.equals(reqVo.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | SysDept sysDept = deptMapper.selectDeptById(reqVo.getDeptId()); |
| | | if (null == sysDept){ |
| | | throw new ApiException("部门不存在!"); |
| | | } |
| | | if (!companyId.equals(sysDept.getCompanyId())){ |
| | | if (!reqVo.getCompanyId().equals(sysDept.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | SysDept dept = new SysDept(); |
| | |
| | | @Transactional |
| | | public int initFunctionalDistribution(Long companyId) { |
| | | |
| | | if (!companyId.equals(SecurityUtils.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // if (!companyId.equals(SecurityUtils.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | |
| | | sysFunctionalDistributionMapper.delByCompanyId(companyId); |
| | | SysDept sysDept = new SysDept(); |
| | |
| | | |
| | | @Override |
| | | public int saveFunctionalDistribution(FunctionalDistributionVo reqVo) { |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | if (!companyId.equals(reqVo.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // Long companyId = SecurityUtils.getCompanyId(); |
| | | // if (!companyId.equals(reqVo.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | List<SysFunctionalDistribution> list = reqVo.getList(); |
| | | if (list != null && !list.isEmpty()) |
| | | { |
| | | for (SysFunctionalDistribution sysFunctionalDistribution : list) { |
| | | sysFunctionalDistribution.setCompanyId(companyId); |
| | | sysFunctionalDistribution.setCompanyId(reqVo.getCompanyId()); |
| | | sysFunctionalDistribution.setUpdateBy(SecurityUtils.getUsername()); |
| | | sysFunctionalDistribution.setUpdateTime(LocalDateTime.now()); |
| | | } |
| | |
| | | { |
| | | List<SysMenu> menuList = null; |
| | | // 管理员显示所有菜单信息 |
| | | if (SecurityUtils.isAdmin(userId)) |
| | | if (SecurityUtils.adminUser() ) |
| | | { |
| | | menuList = menuMapper.selectMenuList(menu); |
| | | } |
| | |
| | | public List<SysMenu> selectMenuTreeByUserId(Long userId) |
| | | { |
| | | List<SysMenu> menus = null; |
| | | if (SecurityUtils.isAdmin(userId)) |
| | | if (SecurityUtils.adminUser() ) |
| | | { |
| | | menus = menuMapper.selectMenuTreeAll(); |
| | | } |
| | |
| | | @Override |
| | | public void checkRoleDataScope(Long... roleIds) |
| | | { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) |
| | | if (!SecurityUtils.adminUser()) |
| | | { |
| | | for (Long roleId : roleIds) |
| | | { |
| | |
| | | import com.gkhy.exam.common.utils.RedisUtils; |
| | | import com.gkhy.exam.common.utils.SecurityUtils; |
| | | import com.gkhy.exam.common.utils.StringUtils; |
| | | import com.gkhy.exam.system.domain.SysUserRole; |
| | | import com.gkhy.exam.system.mapper.SysUserMapper; |
| | | import com.gkhy.exam.system.mapper.SysUserRoleMapper; |
| | | import com.gkhy.exam.system.service.SysConfigService; |
| | | import com.gkhy.exam.system.service.SysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private SysConfigService configService; |
| | | @Autowired |
| | | private Validator validator; |
| | | @Autowired |
| | | private SysUserRoleMapper userRoleMapper; |
| | | |
| | | @Override |
| | | public CommonPage<SysUser> selectUserList(SysUser user) { |
| | |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(Base64.decodeStr(user.getPassword()))); |
| | | int row=baseMapper.insert(user); |
| | | List<SysUserRole> userRoleList = new ArrayList<>(); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setUserId(user.getId()); |
| | | sysUserRole.setRoleId(2L); |
| | | userRoleList.add(sysUserRole); |
| | | userRoleMapper.batchUserRole(userRoleList); |
| | | |
| | | if(row<1){ |
| | | throw new ApiException("新增用户失败"); |
| | | } |
| | |
| | | |
| | | <select id="selectCompanyBasicList" resultType="com.gkhy.exam.system.domain.CompanyBasic"> |
| | | SELECT |
| | | `id`, |
| | | `company_id`, |
| | | `company_name`, |
| | | `basic`, |
| | | `introduce`, |
| | | `target`, |
| | | `quality`, |
| | | `activity`, |
| | | `audit`, |
| | | `epiboly`, |
| | | `resource`, |
| | | `del_flag`, |
| | | `create_by`, |
| | | `create_time`, |
| | | `update_by`, |
| | | `update_time` |
| | | cb.`id`, |
| | | cb.`company_id`, |
| | | sc.`name` as company_name, |
| | | cb.`basic`, |
| | | cb.`introduce`, |
| | | cb.`target`, |
| | | cb.`quality`, |
| | | cb.`activity`, |
| | | cb.`audit`, |
| | | cb.`epiboly`, |
| | | cb.`resource`, |
| | | cb.`del_flag`, |
| | | cb.`create_by`, |
| | | cb.`create_time`, |
| | | cb.`update_by`, |
| | | cb.`update_time` |
| | | FROM |
| | | company_basic |
| | | company_basic cb |
| | | left join sys_company sc on cb.company_id = sc.id |
| | | WHERE |
| | | del_flag = 1 |
| | | cb.del_flag = 1 |
| | | <if test="companyId!=null and companyId != ''"> |
| | | and company_id = #{companyId} |
| | | and cb.company_id = #{companyId} |
| | | </if> |
| | | ORDER BY |
| | | create_time DESC |
| | | cb.create_time DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectCompanyCertificateList" resultType="com.gkhy.exam.system.domain.CompanyCertificate"> |
| | | SELECT |
| | | `id`, |
| | | `company_id`, |
| | | `company_name`, |
| | | `certificate_name`, |
| | | `certificate_num`, |
| | | `effective_time`, |
| | | `file_name`, |
| | | `file_path`, |
| | | `del_flag`, |
| | | `create_by`, |
| | | `create_time`, |
| | | `update_by`, |
| | | `update_time` |
| | | cc.`id`, |
| | | cc.`company_id`, |
| | | sc.`name` as company_name, |
| | | cc.`certificate_name`, |
| | | cc.`certificate_num`, |
| | | cc.`effective_time`, |
| | | cc.`file_name`, |
| | | cc.`file_path`, |
| | | cc.`del_flag`, |
| | | cc.`create_by`, |
| | | cc.`create_time`, |
| | | cc.`update_by`, |
| | | cc.`update_time` |
| | | FROM |
| | | company_certificate |
| | | company_certificate cc |
| | | left join sys_company sc on cc.company_id = sc.id |
| | | WHERE |
| | | del_flag = 1 |
| | | cc.del_flag = 1 |
| | | <if test="companyId!=null and companyId!=''"> |
| | | and company_id = #{companyId} |
| | | and cc.company_id = #{companyId} |
| | | </if> |
| | | ORDER BY |
| | | create_time DESC |
| | | cc.create_time DESC |
| | | </select> |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.gkhy.exam.system.mapper.CompanyIndustryTemplateMapper"> |
| | | <update id="updateCompanyIndustryTemplateById" parameterType="com.gkhy.exam.system.domain.CompanyIndustryTemplate"> |
| | | UPDATE company_industry_template |
| | | <set> |
| | | <if test="companyId != null and companyId != ''" > |
| | | company_id = #{companyId}, |
| | | </if> |
| | | <if test="companyName != null and companyName != ''" > |
| | | company_name = #{companyName}, |
| | | </if> |
| | | <if test="templateName != null and templateName !=''" > |
| | | template_name = #{templateName}, |
| | | </if> |
| | | <if test="industryType != null " > |
| | | industry_type = #{industryType}, |
| | | </if> |
| | | <if test="filePath != null and filePath !=''" > |
| | | file_path = #{filePath}, |
| | | </if> |
| | | <if test="format != null and format !=''" > |
| | | format = #{format}, |
| | | </if> |
| | | <if test="delFlag != null and delFlag != ''" > |
| | | del_flag = #{delFlag}, |
| | | </if> |
| | | <if test="createBy != null" > |
| | | create_by = #{createBy}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime}, |
| | | </if> |
| | | <if test="updateBy != null" > |
| | | update_by = #{updateBy}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime} |
| | | </if> |
| | | </set> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <select id="selectCompanyIndustryTemplateList" resultType="com.gkhy.exam.system.domain.CompanyIndustryTemplate"> |
| | | SELECT |
| | | `id`, |
| | | `company_id`, |
| | | `company_name`, |
| | | `template_name`, |
| | | `industry_type`, |
| | | `file_path`, |
| | | `format`, |
| | | `del_flag`, |
| | | `create_by`, |
| | | `create_time`, |
| | | `update_by`, |
| | | `update_time` |
| | | FROM |
| | | company_industry_template |
| | | WHERE |
| | | del_flag = 0 |
| | | <if test="companyId!=null and companyId!=''"> |
| | | and company_id = #{companyId} |
| | | </if> |
| | | ORDER BY |
| | | create_time DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectCompanyQualityPolicyList" resultType="com.gkhy.exam.system.domain.CompanyQualityPolicy"> |
| | | SELECT |
| | | `id`, |
| | | `company_id`, |
| | | company_name, |
| | | `policy`, |
| | | `del_flag`, |
| | | `create_by`, |
| | | `create_time`, |
| | | `update_by`, |
| | | `update_time` |
| | | cqp.`id`, |
| | | cqp.`company_id`, |
| | | sc.`name` as company_name, |
| | | cqp.`policy`, |
| | | cqp.`del_flag`, |
| | | cqp.`create_by`, |
| | | cqp.`create_time`, |
| | | cqp.`update_by`, |
| | | cqp.`update_time` |
| | | FROM |
| | | company_quality_policy |
| | | company_quality_policy cqp |
| | | left join sys_company sc on cqp.company_id = sc.id |
| | | WHERE |
| | | del_flag = 1 |
| | | cqp.del_flag = 1 |
| | | <if test="companyId!=null and companyId!=''"> |
| | | and company_id = #{companyId} |
| | | and cqp.company_id = #{companyId} |
| | | </if> |
| | | ORDER BY |
| | | create_time DESC |
| | | cqp.create_time DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | FROM |
| | | company_roster |
| | | WHERE |
| | | del_flag = 1 |
| | | del_flag = 0 |
| | | <if test="companyId!=null and companyId!=''"> |
| | | and company_id = #{companyId} |
| | | </if> |
| | |
| | | |
| | | <select id="selectCompanySummaryList" resultType="com.gkhy.exam.system.domain.CompanySummary"> |
| | | SELECT |
| | | `id`, |
| | | `company_id`, |
| | | `company_name`, |
| | | `company_summary`, |
| | | `del_flag`, |
| | | `create_by`, |
| | | `create_time`, |
| | | `update_by`, |
| | | `update_time` |
| | | cs.`id`, |
| | | cs.`company_id`, |
| | | sc.`name` as company_name, |
| | | cs.`company_summary`, |
| | | cs.`del_flag`, |
| | | cs.`create_by`, |
| | | cs.`create_time`, |
| | | cs.`update_by`, |
| | | cs.`update_time` |
| | | FROM |
| | | company_summary |
| | | company_summary cs |
| | | left join sys_company sc on cs.company_id = sc.id |
| | | WHERE |
| | | del_flag = 1 |
| | | cs.del_flag = 1 |
| | | <if test="companyId!=null and companyId!=''"> |
| | | and company_id = #{companyId} |
| | | and cs.company_id = #{companyId} |
| | | </if> |
| | | ORDER BY |
| | | create_time DESC |
| | | cs.create_time DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | SELECT |
| | | qa.`id`, |
| | | qa.`company_id`, |
| | | q.company_name, |
| | | sc.`name` as company_name, |
| | | q.year, |
| | | q.type, |
| | | q.depart_name, |
| | |
| | | FROM |
| | | quality_accomplish qa |
| | | LEFT JOIN quality q ON qa.quality_id = q.id |
| | | left join sys_company sc on q.company_id = sc.id |
| | | WHERE |
| | | qa.del_flag = 1 |
| | | <if test="companyId!=null and companyId!=''"> |
| | |
| | | SELECT |
| | | qd.`id`, |
| | | qd.`company_id`, |
| | | q.company_name, |
| | | sc.`name` as company_name, |
| | | q.`year`, |
| | | q.type, |
| | | q.depart_name, |
| | |
| | | qd.`update_time` |
| | | FROM quality_decompose qd |
| | | LEFT JOIN quality q on qd.quality_id = q.id |
| | | left join sys_company sc on q.company_id = sc.id |
| | | WHERE qd.del_flag = 1 |
| | | <if test="companyId !=null and companyId!=''"> |
| | | and q.company_id =#{companyId} |
| | |
| | | where del_flag = 1 |
| | | and quality_id=#{qualityId} |
| | | </select> |
| | | <select id="selectByDelFlag" resultType="java.lang.Integer"> |
| | | select quality_id from quality_decompose where del_flag = 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectQualityTarget" resultType="com.gkhy.exam.system.domain.vo.QualityTargetVo"> |
| | | SELECT |
| | | `id`, |
| | | `company_id`, |
| | | `company_name`, |
| | | `year`, |
| | | `num`, |
| | | `type`, |
| | | `depart_id`, |
| | | `depart_name`, |
| | | `method`, |
| | | `compilation_id`, |
| | | `compilation_name`, |
| | | `compilation_time`, |
| | | `quality_id`, |
| | | `quality_name`, |
| | | `quality_time`, |
| | | `lead_id`, |
| | | `lead_name`, |
| | | `lead_time` |
| | | FROM quality |
| | | q.`id`, |
| | | q.`company_id`, |
| | | sc.`name` as `company_name`, |
| | | q.`year`, |
| | | q.`num`, |
| | | q.`type`, |
| | | q.`depart_id`, |
| | | q.`depart_name`, |
| | | q.`method`, |
| | | q.`compilation_id`, |
| | | q.`compilation_name`, |
| | | q.`compilation_time`, |
| | | q.`quality_id`, |
| | | q.`quality_name`, |
| | | q.`quality_time`, |
| | | q.`lead_id`, |
| | | q.`lead_name`, |
| | | q.`lead_time` |
| | | FROM quality q |
| | | left join sys_company sc on q.company_id = sc.id |
| | | WHERE |
| | | del_flag=1 |
| | | q.del_flag=1 |
| | | <if test="companyId!=null and companyId!=''"> |
| | | and company_id = #{companyId} |
| | | and q.company_id = #{companyId} |
| | | </if> |
| | | <if test="year!=null and year!=''"> |
| | | and `year` = #{year} |
| | | and q.`year` = #{year} |
| | | </if> |
| | | <if test="type!=null and type!=''"> |
| | | and `type` = #{type} |
| | | and q.`type` = #{type} |
| | | </if> |
| | | ORDER BY |
| | | create_time DESC |
| | | q.create_time DESC |
| | | </select> |
| | | <select id="selectQualityByType" resultType="com.gkhy.exam.system.domain.Quality"> |
| | | SELECT |
| | | `id`, |
| | | `company_id`, |
| | | `company_name`, |
| | | `year`, |
| | | `num`, |
| | | `type`, |
| | | `depart_id`, |
| | | `depart_name`, |
| | | `method`, |
| | | `compilation_id`, |
| | | `compilation_name`, |
| | | `compilation_time`, |
| | | `quality_id`, |
| | | `quality_name`, |
| | | `quality_time`, |
| | | `lead_id`, |
| | | `lead_name`, |
| | | `lead_time` |
| | | FROM quality |
| | | q.`id`, |
| | | q.`company_id`, |
| | | sc.`name` as company_name, |
| | | q.`year`, |
| | | q.`num`, |
| | | q.`type`, |
| | | q.`depart_id`, |
| | | q.`depart_name`, |
| | | q.`method`, |
| | | q.`compilation_id`, |
| | | q.`compilation_name`, |
| | | q.`compilation_time`, |
| | | q.`quality_id`, |
| | | q.`quality_name`, |
| | | q.`quality_time`, |
| | | q.`lead_id`, |
| | | q.`lead_name`, |
| | | q.`lead_time` |
| | | FROM quality q |
| | | left join sys_company sc on q.company_id = sc.id |
| | | WHERE |
| | | del_flag=1 and `type` = #{type} and `year` = #{year} |
| | | q.del_flag=1 and q.`type` = #{type} and q.`year` = #{year} |
| | | <if test="type == 1"> |
| | | and company_id = #{companyId} |
| | | and q.company_id = #{companyId} |
| | | </if> |
| | | <if test="type == 2"> |
| | | and depart_id = #{departId} |
| | | and q.depart_id = #{departId} |
| | | </if> |
| | | </select> |
| | | |