优化用户重置密码加密+物料照片批量导入

This commit is contained in:
2026-03-05 14:39:20 +08:00
parent 656267e6b7
commit 5726239eda
8 changed files with 219 additions and 118 deletions

View File

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import lombok.RequiredArgsConstructor;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.web.model.R;
import top.wms.admin.common.controller.BaseController;
import top.wms.admin.material.model.entity.MaterialInfoDO;
import top.wms.admin.material.model.query.MaterialInfoQuery;
@@ -25,9 +26,6 @@ import top.wms.admin.material.model.resp.MaterialImportParseResp;
import top.wms.admin.material.model.resp.MaterialInfoImportResp;
import top.wms.admin.material.model.resp.MaterialInfoResp;
import top.wms.admin.material.service.MaterialInfoService;
import top.wms.admin.system.model.req.user.UserImportReq;
import top.wms.admin.system.model.resp.user.UserImportParseResp;
import top.wms.admin.system.model.resp.user.UserImportResp;
import java.io.IOException;
@@ -45,8 +43,8 @@ import java.io.IOException;
public class MaterialInfoController extends BaseController<MaterialInfoService, MaterialInfoResp, MaterialInfoResp, MaterialInfoQuery, MaterialInfoReq> {
@GetMapping("/code/{code}")
public MaterialInfoDO getMaterialInfoByCode(@PathVariable String code) {
return baseService.getMaterialInfoByCode(code);
public MaterialInfoDO getMaterialInfoByCode(@PathVariable String code) {
return baseService.getMaterialInfoByCode(code);
}
@Operation(summary = "下载导入模板", description = "下载导入模板")
@@ -70,4 +68,15 @@ public class MaterialInfoController extends BaseController<MaterialInfoService,
public MaterialInfoImportResp importUser(@Validated @RequestBody MaterialInfoImportReq req) {
return baseService.importMaterial(req);
}
@Operation(summary = "照片批量导入", description = "照片批量导入")
@SaCheckPermission("admin:materialInfo:import")
@PostMapping("/import/uploadMaterialPhotos")
public R uploadMaterialPhotos(@RequestParam("zipFile") @NotNull(message = "文件不能为空") MultipartFile zipFile) {
ValidationUtils.throwIf(zipFile::isEmpty, "文件不能为空");
String originalFilename = zipFile.getOriginalFilename();
ValidationUtils.throwIf(() -> originalFilename == null || !originalFilename.endsWith(".zip"), "仅支持上传ZIP格式文件");
baseService.uploadMaterialPhotos(zipFile);
return R.ok();
}
}

View File

@@ -93,7 +93,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe
ValidationUtils.throwIf(!ReUtil
.isMatch(RegexConstants.PASSWORD, rawNewPassword), "密码长度为 8-32 个字符,支持大小写字母、数字、特殊字符,至少包含字母和数字");
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
req.setNewPassword("{bcrypt}"+encoder.encode(rawNewPassword));
req.setNewPassword("{bcrypt}" + encoder.encode(rawNewPassword));
baseService.resetPassword(req, id);
}