|
|
|
@ -155,9 +155,9 @@ public class YpController extends Controller {
|
|
|
|
|
* @param tel
|
|
|
|
|
*/
|
|
|
|
|
@Before(POST.class)
|
|
|
|
|
@EmptyInterface({"sfzh"})
|
|
|
|
|
public void save(int task_id, String name, String xb, int bx_id, String address, String father_name, String mother_name, String sfzh, String tel) {
|
|
|
|
|
int result = model.save(task_id, name, xb, bx_id, address, father_name, mother_name, sfzh, tel);
|
|
|
|
|
@EmptyInterface({"name","xb","sfzh","address","father_name","mother_name","tel","uuid"})
|
|
|
|
|
public void save(int task_id, String name, String xb, int bx_id, String address, String father_name, String mother_name, String sfzh, String tel,String uuid) {
|
|
|
|
|
int result = model.save(task_id, name, xb, bx_id, address, father_name, mother_name, sfzh, tel,uuid);
|
|
|
|
|
|
|
|
|
|
Kv kv = Kv.by("success", result);
|
|
|
|
|
if (result == 1) kv.set("message", "获取成功!");
|
|
|
|
@ -216,26 +216,21 @@ public class YpController extends Controller {
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(false, "上传文件类型错误!系统只允许上传jpg格式!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String sfzh = get("sfzh");
|
|
|
|
|
if (StrKit.isBlank(sfzh)) {
|
|
|
|
|
Kv kv = Kv.by("success", false);
|
|
|
|
|
kv.set("message", "没有传入sfzh数据!");
|
|
|
|
|
renderJson(kv);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String uuid=UUID.randomUUID().toString();
|
|
|
|
|
//判断目录是不是存在
|
|
|
|
|
File file = new File(PathKit.getWebRootPath() + "/upload");
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
|
file.mkdirs();// 创建文件夹
|
|
|
|
|
}
|
|
|
|
|
String finalPic = PathKit.getWebRootPath() + "/upload/" + sfzh + ".jpg";
|
|
|
|
|
String finalPic = PathKit.getWebRootPath() + "/upload/" + uuid + ".jpg";
|
|
|
|
|
picFile.getFile().renameTo(new File(finalPic));
|
|
|
|
|
//输出base64编码的jpg文件
|
|
|
|
|
String base64 = Base64Util.fileToBase64(new File(finalPic));
|
|
|
|
|
Kv kv = Kv.by("success", true);
|
|
|
|
|
kv.set("message", "上传成功!");
|
|
|
|
|
kv.set("base64", base64);
|
|
|
|
|
kv.set("uuid",uuid);
|
|
|
|
|
renderJson(kv);
|
|
|
|
|
//path : /FengHuang/upload/sfzh+".jpg"
|
|
|
|
|
}
|
|
|
|
|