医生执照保存地址修改

master
gongzhenkun 2 years ago
parent 9283272a0d
commit 5b2f2985ee

@ -296,6 +296,6 @@ public class FileUploadUtils
logger.error("code IOException:", e); logger.error("code IOException:", e);
e.printStackTrace(); e.printStackTrace();
} }
return path + picPath; return picPath;
} }
} }

@ -9,6 +9,7 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Base64;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -316,4 +317,28 @@ public class FileUtils
throw new ServiceException(imageName + " :Base64转图片错误"); throw new ServiceException(imageName + " :Base64转图片错误");
} }
} }
public static String GenerateImage(String imgStr)
{
Base64.Decoder decoder = Base64.getDecoder();
try
{
//Base64解码
byte[] b = decoder.decode(imgStr);
for (int i = 0; i < b.length; ++i)
{
if (b[i] < 0)
{
b[i] += 256;
}
}
return writeImportBytes(b);
}
catch (Exception e)
{
throw new ServiceException("Base64转图片错误,message is " + e.getMessage());
}
}
} }

@ -151,7 +151,7 @@ public class SysLoginService
public AjaxResult loginForAppFillInfo(AppRegisterReq req) { public AjaxResult loginForAppFillInfo(AppRegisterReq req) {
if (StringUtils.isNotEmpty(req.getMedicalLicense())) { if (StringUtils.isNotEmpty(req.getMedicalLicense())) {
log.info("MedicalLicense is not null."); log.info("MedicalLicense is not null.");
req.setMedicalLicense(FileUtils.GenerateImage(req.getMedicalLicense(), "医生执照")); req.setMedicalLicense(FileUtils.GenerateImage(req.getMedicalLicense()));
} }
log.info("login for app fill info req :{}", req); log.info("login for app fill info req :{}", req);
// 查询sys_user数据 // 查询sys_user数据

@ -152,7 +152,7 @@ public class WechatServiceImpl implements IWechatService {
// 查询手机号是否存在医生信息 // 查询手机号是否存在医生信息
TDoctor tDoctor = new TDoctor(); TDoctor tDoctor = new TDoctor();
if (StringUtils.isNotEmpty(req.getMedicalLicense())) { if (StringUtils.isNotEmpty(req.getMedicalLicense())) {
req.setMedicalLicense(FileUtils.GenerateImage(req.getMedicalLicense(), "医生执照")); req.setMedicalLicense(FileUtils.GenerateImage(req.getMedicalLicense()));
} }
BeanUtils.copyProperties(req, tDoctor); BeanUtils.copyProperties(req, tDoctor);
TDoctor currentDoctor = tDoctorMapper.selectTDoctorByPhone(req.getPhone()); TDoctor currentDoctor = tDoctorMapper.selectTDoctorByPhone(req.getPhone());

Loading…
Cancel
Save