Merge remote-tracking branch 'origin/master'

master
chenfei 2 years ago
commit 533ceb9291

@ -424,7 +424,7 @@ public class AppController extends BaseController
tImage.setThirdId(recordId);
tImage.setCreateTime(new Date());
tImage.setName(name);
String path=GenerateImage(value,name);
String path=FileUtils.GenerateImage(value,name);
tImage.setPath(path);
imageService.insertTImage(tImage);
}
@ -470,7 +470,7 @@ public class AppController extends BaseController
{
String imageKey=keys[i];
String imgStr=parents.get(i).getJSONObject(imageKey).getString("v");
String path=GenerateImage(imgStr,imageKey);
String path=FileUtils.GenerateImage(imgStr,imageKey);
parents.get(i).getJSONObject(keys[i]).put("v",null);
TImage tImage = new TImage();
tImage.setName(imageKey);
@ -499,28 +499,4 @@ public class AppController extends BaseController
return jsonObject;
}
public static String GenerateImage(String imgStr,String imageName)
{
BASE64Decoder decoder = new BASE64Decoder();
try
{
//Base64解码
byte[] b = decoder.decodeBuffer(imgStr);
for (int i = 0; i < b.length; ++i)
{
if (b[i] < 0)
{
b[i] += 256;
}
}
return FileUtils.writeImportBytes(b);
}
catch (Exception e)
{
throw new ServiceException(imageName + " :Base64转图片错误");
}
}
}

@ -11,6 +11,8 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.exception.ServiceException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.common.config.RuoYiConfig;
@ -18,6 +20,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.apache.commons.io.FilenameUtils;
import sun.misc.BASE64Decoder;
/**
*
@ -290,4 +293,27 @@ public class FileUtils
return baseName;
}
public static String GenerateImage(String imgStr,String imageName)
{
BASE64Decoder decoder = new BASE64Decoder();
try
{
//Base64解码
byte[] b = decoder.decodeBuffer(imgStr);
for (int i = 0; i < b.length; ++i)
{
if (b[i] < 0)
{
b[i] += 256;
}
}
return FileUtils.writeImportBytes(b);
}
catch (Exception e)
{
throw new ServiceException(imageName + " :Base64转图片错误");
}
}
}

@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.system.domain.TDoctor;
import com.ruoyi.system.domain.req.AppRegisterReq;
import com.ruoyi.system.mapper.TDoctorMapper;
@ -150,7 +151,7 @@ public class SysLoginService
public AjaxResult loginForAppFillInfo(AppRegisterReq req) {
if (StringUtils.isNotEmpty(req.getMedicalLicense())) {
log.info("MedicalLicense is not null.");
req.setMedicalLicense(FileUploadUtils.generateImage(req.getMedicalLicense(), uploadFilePath));
req.setMedicalLicense(FileUtils.GenerateImage(req.getMedicalLicense(), "医生执照"));
}
log.info("login for app fill info req :{}", req);
// 查询sys_user数据

@ -7,6 +7,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.utils.wechat.WechatKeys;
@ -151,7 +152,7 @@ public class WechatServiceImpl implements IWechatService {
// 查询手机号是否存在医生信息
TDoctor tDoctor = new TDoctor();
if (StringUtils.isNotEmpty(req.getMedicalLicense())) {
req.setMedicalLicense(FileUploadUtils.generateImage(req.getMedicalLicense(), uploadFilePath));
req.setMedicalLicense(FileUtils.GenerateImage(req.getMedicalLicense(), "医生执照"));
}
BeanUtils.copyProperties(req, tDoctor);
TDoctor currentDoctor = tDoctorMapper.selectTDoctorByPhone(req.getPhone());

Loading…
Cancel
Save