5 Commits f6df8add6f ... 97f74a7332

Auteur SHA1 Message Date
  Trick 97f74a7332 测试环境 il y a 5 ans
  Trick 0d3d01cb69 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev il y a 5 ans
  Trick 4f5a3c207c Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev il y a 5 ans
  Trick ef41113ed2 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev il y a 5 ans
  Trick d8f8a500ae 测试环境 il y a 5 ans

+ 44 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -59,9 +59,27 @@ public class FileUploadController extends EnvelopRestEndpoint {
    public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        String originalFilename = file.getOriginalFilename();
//        InputStream inputStream = file.getInputStream();
//        UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        return success("上传成功", uploadVO);
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else {
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
        }
        return success("上传成功", uploadVO);
    }
@ -70,10 +88,30 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        String originalFilename = file.getOriginalFilename();
//        InputStream inputStream = file.getInputStream();
//
//    UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        return success("上传成功", uploadVO);
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else {
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
        }
        return success("上传成功", uploadVO);
//        return uploadStream(file);
    }
//    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)

+ 28 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -73,7 +73,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {
            password = userDO.getIdcard().substring(0, 5);
            password = userDO.getIdcard().substring(userDO.getIdcard().length()-6,userDO.getIdcard().length());
        }
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        return userDao.save(userDO);
@ -92,7 +92,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {
            password = userDO.getMobile().substring(0, 5);
            password = userDO.getMobile().substring(userDO.getMobile().length()-6, userDO.getMobile().length());
        }
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        return userDao.save(userDO);
@ -272,7 +272,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        }
        JSONObject returnMsg = new JSONObject();
        returnMsg.put("username",userDO.getUsername());
        returnMsg.put("password",userDO.getSalt());
        returnMsg.put("password",userDO.getIdcard().substring(userDO.getIdcard().length()-6,userDO.getIdcard().length()));
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", returnMsg);
        return result;
@ -440,9 +440,32 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
            result.put("msg","user not exist for id : " + userId);
            return result;
        }
        registerWithIdcard(user);
//        registerWithIdcard(user);
        String idcard = user.getIdcard();
        String mobile = user.getMobile();
        String password = null;
        if(!StringUtils.isEmpty(password)&&idcard.length()>10){
            password = idcard.substring(idcard.length()-6,idcard.length());
        }else if(!StringUtils.isEmpty(mobile)&&mobile.length()>=11){
            password = mobile.substring(mobile.length()-6,mobile.length());
        }
        if(StringUtils.isEmpty(password)){
            result.put("response", ConstantUtils.FAIL);
            result.put("msg","idcard or moblie not exist : " + userId);
            return result;
        }
        user.setSalt(randomString(5));
        user.setEnabled(true);
        user.setLocked(false);
        user.setLoginFailureCount(0);
        user.setPassword(MD5.md5Hex(password + "{" + user.getSalt() + "}"));
        userDao.save(user);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg", user.getSalt());
        result.put("msg", password);
        return result;
    }