wang_xy hai 1 ano
pai
achega
3d8b82073b

+ 18 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -41,16 +41,32 @@ public class SysLoginController {
     private final ISysUserService userService;
 
     /**
-     * 登录方法
+     * 登录方法(电脑端)
      *
      * @param loginBody 登录信息
      * @return 结果
      */
     @SaIgnore
-    @PostMapping("/login")
+    @PostMapping("/loginpc")
     public R<Map<String, Object>> login(@Validated @RequestBody LoginBody loginBody) {
         Map<String, Object> ajax = new HashMap<>();
         // 生成令牌
+        String token = loginService.loginpc(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
+            loginBody.getUuid(),loginBody.getType());
+        ajax.put(Constants.TOKEN, token);
+        return R.ok(ajax);
+    }
+    /**
+     * 登录方法(手机端)
+     *
+     * @param loginBody 登录信息
+     * @return 结果
+     */
+    @SaIgnore
+    @PostMapping("/login")
+    public R<Map<String, Object>> loginapp(@Validated @RequestBody LoginBody loginBody) {
+        Map<String, Object> ajax = new HashMap<>();
+        // 生成令牌
         String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
             loginBody.getUuid(),loginBody.getType());
         ajax.put(Constants.TOKEN, token);

+ 24 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java

@@ -68,6 +68,30 @@ public class SysLoginService {
      * @return 结果
      */
     public String login(String username, String password, String code, String uuid ,String type) {
+        // 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可
+        SysUser user= loadUserByUsername(username,type);
+        checkLogin(LoginType.PASSWORD, username, () -> !BCrypt.checkpw(password, user.getPassword()));
+        // 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
+        LoginUser loginUser = buildLoginUser(user);
+        // 生成token
+        LoginHelper.loginByDevice(loginUser, DeviceType.PC);
+
+        recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"));
+        recordLoginInfo(user.getUserId(), username);
+        return StpUtil.getTokenValue();
+    }
+
+    /**
+     * 登录验证
+     *
+     * @param username 用户名
+     * @param password 密码
+     * @param code     验证码
+     * @param uuid     唯一标识
+     * @param type     唯一标识
+     * @return 结果
+     */
+    public String loginpc(String username, String password, String code, String uuid ,String type) {
         boolean captchaEnabled = configService.selectCaptchaEnabled();
         // 验证码开关
         if (captchaEnabled) {

+ 1 - 1
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/GImportVo.java

@@ -38,7 +38,7 @@ public class GImportVo implements Serializable {
     private String phone;
     @ExcelProperty(value = "管理所")
     private String administrative;
-    @ExcelProperty(value = "来源(请填写“现场规模”或“一体化平台”)")
+    @ExcelProperty(value = "来源(请填写“新增”或“一体化平台”)")
     private String source;
 
 }

+ 44 - 12
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngiineeringPhotoServiceImpl.java

@@ -312,8 +312,11 @@ public class ZEngiineeringPhotoServiceImpl implements IZEngiineeringPhotoService
         zEngineeringCivilBo.getzEngineeringNodeBo().getzEngineeringInfoBoList().forEach(zEngineeringInfoBo -> {
                 zEngineeringInfoBo.getzEngiineeringPhotoBoList().forEach(photo -> {
                     if (StringUtils.isNotBlank(photo)) {
+                        try {
                         // 创建最外层文件夹
-                        File file = new File(filePath);
+                        byte[] fileNameBytes = filePath.getBytes("UTF-8");
+                        // 使用UTF-8编码创建文件
+                        File file = new File(new String(fileNameBytes, "UTF-8"));
                         if (!file.exists()) {
                             file.mkdirs();
                         }
@@ -323,55 +326,84 @@ public class ZEngiineeringPhotoServiceImpl implements IZEngiineeringPhotoService
 //                            headFile.mkdirs();
 //                        }
                         // 小区下再次创建小区,本级用于导出
-                        File areaFile = new File(file.getPath() + "/" + zEngineeringCivilBo.getAreaId());
+//                        File areaFile = new File(file.getPath() + "/" + zEngineeringCivilBo.getAreaId());
+                        byte[] areafileNameBytes = (file.getPath() + "/" + zEngineeringCivilBo.getAreaId()).getBytes("UTF-8");
+                        // 使用UTF-8编码创建文件
+                        File areaFile = new File(new String(areafileNameBytes, "UTF-8"));
                         if (!areaFile.exists()) {
                             areaFile.mkdirs();
                         }
                         // 楼
-                        File buildingFile = new File(areaFile.getPath() + "/" + zEngineeringCivilBo.getBuildingId());
+//                        File buildingFile = new File(areaFile.getPath() + "/" + zEngineeringCivilBo.getBuildingId());
+                        byte[] buildingfileNameBytes = (areaFile.getPath() + "/" + zEngineeringCivilBo.getBuildingId()).getBytes("UTF-8");
+                        // 使用UTF-8编码创建文件
+                        File buildingFile = new File(new String(buildingfileNameBytes, "UTF-8"));
                         if (!buildingFile.exists()) {
                             buildingFile.mkdirs();
                         }
                         // 单元
-                        File unitFile = new File(buildingFile.getPath() + "/" + zEngineeringCivilBo.getUnitId());
+//                        File unitFile = new File(buildingFile.getPath() + "/" + zEngineeringCivilBo.getUnitId());
+                        byte[] unitfileNameBytes = (buildingFile.getPath() + "/" + zEngineeringCivilBo.getUnitId()).getBytes("UTF-8");
+                        // 使用UTF-8编码创建文件
+                        File unitFile = new File(new String(unitfileNameBytes, "UTF-8"));
                         if (!unitFile.exists()) {
                             unitFile.mkdirs();
                         }
                         // 房间
-                        File houseFile = new File(unitFile.getPath() + "/" + zEngineeringCivilBo.getHouseId());
+//                        File houseFile = new File(unitFile.getPath() + "/" + zEngineeringCivilBo.getHouseId());
+                        byte[] housefileNameBytes = (unitFile.getPath() + "/" + zEngineeringCivilBo.getHouseId()).getBytes("UTF-8");
+                        // 使用UTF-8编码创建文件
+                        File houseFile = new File(new String(housefileNameBytes, "UTF-8"));
                         if (!houseFile.exists()) {
                             houseFile.mkdirs();
                         }
                         // 工程周期
-                        File EnginCycleFile = new File(houseFile.getPath() + "/" + zEngineeringCivilBo.getEnginCycle());
+//                        File EnginCycleFile = new File(houseFile.getPath() + "/" + zEngineeringCivilBo.getEnginCycle());
+                            byte[] EnginCycleNameBytes = (houseFile.getPath() + "/" + zEngineeringCivilBo.getEnginCycle()).getBytes("UTF-8");
+                            // 使用UTF-8编码创建文件
+                            File EnginCycleFile = new File(new String(EnginCycleNameBytes, "UTF-8"));
                         if (!EnginCycleFile.exists()) {
                             EnginCycleFile.mkdirs();
                         }
                         // 工程类型
-                        File EnginType = new File(EnginCycleFile.getPath() + "/" + zEngineeringCivilBo.getEnginType());
+//                        File EnginType = new File(EnginCycleFile.getPath() + "/" + zEngineeringCivilBo.getEnginType());
+                            byte[] EnginTypeNameBytes = (EnginCycleFile.getPath() + "/" + zEngineeringCivilBo.getEnginType()).getBytes("UTF-8");
+                            // 使用UTF-8编码创建文件
+                            File EnginType = new File(new String(EnginTypeNameBytes, "UTF-8"));
                         if (!EnginType.exists()) {
                             EnginType.mkdirs();
                         }
                         // 工程分类
-                        File EnginClassification = new File(EnginType.getPath() + "/" + zEngineeringCivilBo.getEnginClassification());
+//                        File EnginClassification = new File(EnginType.getPath() + "/" + zEngineeringCivilBo.getEnginClassification());
+                            byte[] EnginClassificationNameBytes = (EnginType.getPath() + "/" + zEngineeringCivilBo.getEnginClassification()).getBytes("UTF-8");
+                            // 使用UTF-8编码创建文件
+                            File EnginClassification = new File(new String(EnginClassificationNameBytes, "UTF-8"));
                         if (!EnginClassification.exists()) {
                             EnginClassification.mkdirs();
                         }
                         // 节点类型
-                        File Type = new File(EnginClassification.getPath() + "/" + zEngineeringCivilBo.getzEngineeringNodeBo().getType());
+//                        File Type = new File(EnginClassification.getPath() + "/" + zEngineeringCivilBo.getzEngineeringNodeBo().getType());
+                            byte[] TypeNameBytes = (EnginClassification.getPath() + "/" + zEngineeringCivilBo.getzEngineeringNodeBo().getType()).getBytes("UTF-8");
+                            // 使用UTF-8编码创建文件
+                            File Type = new File(new String(TypeNameBytes, "UTF-8"));
                         if (!Type.exists()) {
                             Type.mkdirs();
                         }
                         // 时间
-                        File CreateTimeFile = new File(Type.getPath() + "/" + new SimpleDateFormat("yyyy-MM-dd").format(zEngineeringInfoBo.getCreateTime()) );
+//                        File CreateTimeFile = new File(Type.getPath() + "/" + new SimpleDateFormat("yyyy-MM-dd").format(zEngineeringInfoBo.getCreateTime()) );
+                            byte[] CreateTimeFileNameBytes = (Type.getPath() + "/" + new SimpleDateFormat("yyyy-MM-dd").format(zEngineeringInfoBo.getCreateTime())).getBytes("UTF-8");
+                            // 使用UTF-8编码创建文件
+                            File CreateTimeFile = new File(new String(CreateTimeFileNameBytes, "UTF-8"));
                         if (!CreateTimeFile.exists()) {
                             CreateTimeFile.mkdirs();
                         }
-                        File CreateByFile = new File(CreateTimeFile.getPath() + "/" + zEngineeringInfoBo.getConstructUser());
+//                        File CreateByFile = new File(CreateTimeFile.getPath() + "/" + zEngineeringInfoBo.getConstructUser());
+                            byte[] CreateByFileNameBytes = (CreateTimeFile.getPath() + "/" + zEngineeringInfoBo.getConstructUser()).getBytes("UTF-8");
+                            // 使用UTF-8编码创建文件
+                            File CreateByFile = new File(new String(CreateByFileNameBytes, "UTF-8"));
                         if (!CreateByFile.exists()) {
                             CreateByFile.mkdirs();
                         }
-                        try {
                             obsService.download(CreateByFile.getPath(), photo.substring(photo.lastIndexOf("/")+1));
                             System.out.println(photo.substring(photo.lastIndexOf("/")+1));
                             System.out.println(photo);