| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.common.validator.ComprehensiveFileValidator; |
| | | import com.vci.ubcs.system.cache.NacosConfigCache; |
| | | import com.vci.ubcs.system.user.entity.User; |
| | | import com.vci.ubcs.system.user.excel.UserExcel; |
| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import com.vci.ubcs.common.cache.CacheNames; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.hibernate.validator.internal.util.logging.Log; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import com.vci.ubcs.system.user.service.IUserService; |
| | | import com.vci.ubcs.system.user.vo.UserVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | |
| | | @RestController |
| | | @RequestMapping |
| | | @AllArgsConstructor |
| | | @lombok.extern.java.Log |
| | | @Slf4j |
| | | public class UserController { |
| | | |
| | | private final IUserService userService; |
| | | |
| | | private final BladeRedis bladeRedis; |
| | | |
| | | private final NacosConfigCache nacosConfigCache; |
| | | |
| | | /** |
| | | * 文件安全检查 |
| | | */ |
| | | private ComprehensiveFileValidator fileValidator; |
| | | |
| | | /** |
| | | * 查询单条 |
| | |
| | | @ApiOperationSupport(order = 12) |
| | | @ApiOperation(value = "导入用户", notes = "传入excel") |
| | | public R importUser(MultipartFile file, Integer isCovered) { |
| | | // 使用文件安全验证器 |
| | | ComprehensiveFileValidator.UploadValidationResult result = fileValidator.validateFile(file); |
| | | if (!result.isValid()) { |
| | | return R.fail(result.getMessage()); |
| | | } |
| | | UserImporter userImporter = new UserImporter(userService, isCovered == 1); |
| | | ExcelUtil.save(file, userImporter, UserExcel.class); |
| | | return R.success("操作成功"); |