multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/ProcessInspectionController.java
对比新文件 @@ -0,0 +1,77 @@ package com.gkhy.exam.admin.controller.web; import com.gkhy.exam.common.api.CommonResult; import com.gkhy.exam.system.domain.ProcessInspection; import com.gkhy.exam.system.domain.StandardizedTemplate; import com.gkhy.exam.system.service.ProcessInspectionService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; 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 = "过程检验管理") @RestController @RequestMapping("/process") public class ProcessInspectionController { @Autowired private ProcessInspectionService processInspectionService; /** * 过程检验列表 * @param companyId * @return */ @ApiOperation(value = "过程检验列表(分页)") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "int", required = false, value = "公司iD"), @ApiImplicitParam(paramType = "query", name = "type", dataType = "int", required = true, value = "类型1过程检验2最终检验"), @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = true, value = "页码"), @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = true, value = "每页数量") }) @GetMapping("/inspection/list") public CommonResult selectProcessInspectionList(Integer companyId, @RequestParam("type") Integer templateType){ return CommonResult.success(processInspectionService.selectProcessInspectionList(companyId, templateType)); } /** * 过程检验新增 * @param processInspection * @return */ @ApiOperation(value = "过程检验新增") @PostMapping("/inspection/insert") public CommonResult insertProcessInspection(@Validated @RequestBody ProcessInspection processInspection){ return processInspectionService.insertProcessInspection(processInspection); } /** * 过程检验修改 * @param processInspection * @return */ @ApiOperation(value = "过程检验修改") @PostMapping("/inspection/update") public CommonResult updateProcessInspection(@Validated @RequestBody ProcessInspection processInspection){ return processInspectionService.updateProcessInspection(processInspection); } /** * 过程检验删除 * @param inspectionId * @return */ @ApiOperation(value = "过程检验删除") @GetMapping("/inspection/deleted") public CommonResult deletedProcessInspection(@RequestParam("inspectionId") Integer inspectionId){ return processInspectionService.deletedProcessInspection(inspectionId); } } multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java
@@ -78,7 +78,7 @@ @TableField("person_type") private Integer personType; @NotBlank(message = "职称不能为空") // @NotBlank(message = "职称不能为空") @ApiModelProperty("职称1、初级2中级3高级") @TableField("positional") private String positional; @@ -152,7 +152,7 @@ private LocalDate resignTime; @ApiModelProperty(value = "学历1、高中及以下2、专科3、本科4、硕士5、博士及以上",required = true) @NotNull(message = "学历不能为空") // @NotNull(message = "学历不能为空") @TableField("qualification") private Integer qualification; @@ -175,6 +175,9 @@ @TableField(exist = false) private List<SysRole> roles; @TableField(exist = false) private Long userId; // @TableField(exist = false) // @ApiModelProperty("角色ids") // private Set<Long> roleIds; multi-common/src/main/java/com/gkhy/exam/common/domain/model/LoginUser.java
@@ -22,10 +22,12 @@ private String username; @ApiModelProperty("token") private String token; @ApiModelProperty("用户id") @ApiModelProperty("学员id") private Long id; @ApiModelProperty("token到期时间") private Long expireTime; @ApiModelProperty("公司id") private Long companyId; @ApiModelProperty("用户id") private Long userId; } multi-framework/src/main/java/com/gkhy/exam/framework/web/service/SysLoginService.java
@@ -156,6 +156,7 @@ LoginUser loginUser= new LoginUser() .setId(loginUserDetails.getUser().getId()) .setUsername(loginUserDetails.getUsername()) .setUserId(loginUserDetails.getUser().getUserId()) .setCompanyId(loginUserDetails.getUser().getCompanyId()); loginUser.setToken(tokenService.createToken(loginUserDetails.getUsername()+loginUserTagEnum.getCode())); tokenService.cacheUserToken(loginUserDetails.getUsername(),loginUser.getToken()); multi-framework/src/main/java/com/gkhy/exam/framework/web/service/UserDetailServiceImpl.java
@@ -42,6 +42,7 @@ if(student!=null) { user = new SysUser() .setId(student.getId()) .setUserId(student.getUserId()) .setUserType(UserTypeEnum.STUDENT.getCode()) .setUsername(username) .setCompanyId(student.getCompanyId()) multi-system/src/main/java/com/gkhy/exam/system/domain/ProcessInspection.java
对比新文件 @@ -0,0 +1,61 @@ 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 java.io.Serializable; import java.time.LocalDateTime; @Setter @Getter @TableName("process_inspection") @ApiModel(value = "processInspection",description = "过程和最终检验") public class ProcessInspection implements Serializable { @ApiModelProperty("主键") @TableId(value = "id", type = IdType.AUTO) private Integer id; @ApiModelProperty(value = "企业ID") @TableField("company_id") private Long companyId; @TableField(exist = false) private String companyName; @ApiModelProperty(value = "类型1过程检验 2最终检验") @TableField("type") private Integer type; @ApiModelProperty(value = "文件名称") @TableField("file_name") private String fileName; @ApiModelProperty(value = "文件路径") @TableField("file_path") private String filePath; @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; } multi-system/src/main/java/com/gkhy/exam/system/mapper/ProcessInspectionMapper.java
对比新文件 @@ -0,0 +1,13 @@ package com.gkhy.exam.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.system.domain.ProcessInspection; import org.apache.ibatis.annotations.Param; import org.mapstruct.Mapper; import java.util.List; @Mapper public interface ProcessInspectionMapper extends BaseMapper<ProcessInspection> { List<ProcessInspection> selectByCompanyidAndTypeList(@Param("companyId") Integer companyId, @Param("templateType") Integer templateType); } multi-system/src/main/java/com/gkhy/exam/system/service/ProcessInspectionService.java
对比新文件 @@ -0,0 +1,16 @@ 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.ProcessInspection; public interface ProcessInspectionService extends IService<ProcessInspection> { CommonPage selectProcessInspectionList(Integer companyId, Integer templateType); CommonResult insertProcessInspection(ProcessInspection processInspection); CommonResult updateProcessInspection(ProcessInspection processInspection); CommonResult deletedProcessInspection(Integer inspectionId); } multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProcessInspectionServiceImpl.java
对比新文件 @@ -0,0 +1,61 @@ 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.utils.SecurityUtils; import com.gkhy.exam.system.domain.ProcessInspection; import com.gkhy.exam.system.mapper.ProcessInspectionMapper; import com.gkhy.exam.system.service.ProcessInspectionService; import net.sf.jsqlparser.expression.operators.relational.ItemsList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.List; @Service public class ProcessInspectionServiceImpl extends ServiceImpl<ProcessInspectionMapper, ProcessInspection> implements ProcessInspectionService { @Autowired private ProcessInspectionMapper processInspectionMapper; @Override public CommonPage selectProcessInspectionList(Integer companyId, Integer templateType) { boolean admin = SecurityUtils.adminUser(); if (!admin){ if (companyId==null){ companyId = SecurityUtils.getCompanyId().intValue(); } } List<ProcessInspection> processInspections = processInspectionMapper.selectByCompanyidAndTypeList(companyId, templateType); return CommonPage.restPage(processInspections); } @Override public CommonResult insertProcessInspection(ProcessInspection processInspection) { processInspection.setCreateTime(LocalDateTime.now()); processInspection.setCreateBy(SecurityUtils.getUsername()); processInspectionMapper.insert(processInspection); return CommonResult.success(); } @Override public CommonResult updateProcessInspection(ProcessInspection processInspection) { processInspection.setUpdateBy(SecurityUtils.getUsername()); processInspection.setUpdateTime(LocalDateTime.now()); int update = processInspectionMapper.updateById(processInspection); return CommonResult.success(); } @Override public CommonResult deletedProcessInspection(Integer inspectionId) { ProcessInspection processInspection = new ProcessInspection(); processInspection.setUpdateBy(SecurityUtils.getUsername()); processInspection.setUpdateTime(LocalDateTime.now()); processInspection.setId(inspectionId); processInspection.setDelFlag(2); processInspectionMapper.updateById(processInspection); return CommonResult.success(); } } multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysUserServiceImpl.java
@@ -139,6 +139,14 @@ @Override @Transactional(rollbackFor = RuntimeException.class) public int addUser(SysUser user) { ExStudent exStudent = new ExStudent(); exStudent.setCompanyId(user.getCompanyId()); exStudent.setName(user.getName()); exStudent.setPassword(user.getPassword()); exStudent.setDeptId(user.getDeptId()); exStudent.setDuty(user.getDuty()); exStudent.setSex(user.getSex()); exStudent.setPhone(user.getPhone()); checkRequestData(user); checkUserAllowed(user); @@ -148,14 +156,6 @@ batchSaveRole(user.getRoles(), user.getId(), false); ExStudent exStudent = new ExStudent(); exStudent.setCompanyId(user.getCompanyId()); exStudent.setName(user.getName()); exStudent.setPassword(user.getPassword()); exStudent.setDeptId(user.getDeptId()); exStudent.setDuty(user.getDuty()); exStudent.setSex(user.getSex()); exStudent.setPhone(user.getPhone()); exStudent.setUserId(user.getId()); exStudentService.insertStudent(exStudent); multi-system/src/main/resources/mapper/system/ProcessInspectionMapper.xml
对比新文件 @@ -0,0 +1,31 @@ <?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.ProcessInspectionMapper"> <select id="selectByCompanyidAndTypeList" resultType="com.gkhy.exam.system.domain.ProcessInspection"> SELECT pi.`id`, pi.`company_id`, sc.`name` as company_name, pi.`type`, pi.`file_name`, pi.`file_path`, pi.`del_flag`, pi.`create_by`, pi.`create_time`, pi.`update_by`, pi.`update_time` FROM `process_inspection` pi LEFT JOIN sys_company sc ON pi.company_id = sc.id WHERE pi.del_flag = 0 <if test="companyId!=null"> and pi.company_id =#{companyId} </if> <if test="templateType!=null"> and pi.type = #{templateType} </if> </select> </mapper>