소스 검색

上传到bos

user4 5 년 전
부모
커밋
ec14443b79

+ 8 - 3
src/main/java/com/jeeplus/modules/API/userinfo/MyInfoController.java

@@ -1,5 +1,6 @@
 package com.jeeplus.modules.API.userinfo;
 
+import com.jeeplus.common.bos.BOSClientUtil;
 import com.jeeplus.common.config.Global;
 import com.jeeplus.common.json.AjaxJson;
 import com.jeeplus.common.oss.OSSClientUtil;
@@ -163,11 +164,15 @@ public class MyInfoController extends BaseController{
 						inputStream = httpURLConnection.getInputStream();
 
 					}
-					OSSClientUtil ossUtil =new OSSClientUtil();
+					/*OSSClientUtil ossUtil =new OSSClientUtil();
 					String[] arr = temp.split("/");
 					String photoName = System.currentTimeMillis()+arr[arr.length-1];
-					ossUtil.uploadFile2OSS(inputStream, Global.getPhoto(), photoName);
-					user.setPhoto(Global.getAliyunUrl()+"/"+ Global.getPhoto() + photoName);
+					ossUtil.uploadFile2OSS(inputStream, Global.getPhoto(), photoName);*/
+					String path = new StringBuilder("/qrcode/")
+							.append(name+System.currentTimeMillis()).append(".png").toString();
+					BOSClientUtil bosClientUtil = new BOSClientUtil();
+					String uploadPath = bosClientUtil.upload(path, inputStream);
+					user.setPhoto(uploadPath);
 					FileUtils.delFile(Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL  +time);
 				} catch (MalformedURLException e) {
 					e.printStackTrace();

+ 6 - 5
src/main/java/com/jeeplus/modules/sys/service/SystemService.java

@@ -5,6 +5,7 @@ package com.jeeplus.modules.sys.service;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.jeeplus.common.bos.BOSClientUtil;
 import com.jeeplus.common.config.Global;
 import com.jeeplus.common.json.AjaxJson;
 import com.jeeplus.common.oss.OSSClientUtil;
@@ -430,11 +431,11 @@ public class SystemService extends BaseService implements InitializingBean {
                         inputStream = httpURLConnection.getInputStream();
 
                     }
-                    OSSClientUtil ossUtil = new OSSClientUtil();
-                    String[] arr = user.getQrCode().split("/");
-                    String qrCodeName = System.currentTimeMillis() + arr[arr.length - 1];
-                    ossUtil.uploadFile2OSS(inputStream, Global.getRqcode(), qrCodeName);
-                    user.setQrCode(Global.getAliyunUrl() + "/" + Global.getRqcode() + qrCodeName);
+                    String path = new StringBuilder("/qrcode/")
+                            .append(user.getName()+System.currentTimeMillis()).append(".png").toString();
+                    BOSClientUtil bosClientUtil = new BOSClientUtil();
+                    String uploadPath = bosClientUtil.upload(path, inputStream);
+                    user.setQrCode(uploadPath);
                 } catch (MalformedURLException e) {
                     e.printStackTrace();
                 } catch (IOException e) {

+ 11 - 7
src/main/java/com/jeeplus/modules/sys/service/UserService.java

@@ -3,6 +3,7 @@ package com.jeeplus.modules.sys.service;
 
 import com.easemob.server.example.api.impl.EasemobIMUsers;
 import com.google.common.base.Strings;
+import com.jeeplus.common.bos.BOSClientUtil;
 import com.jeeplus.common.config.Global;
 import com.jeeplus.common.oss.OSSClientUtil;
 import com.jeeplus.common.utils.DateUtils;
@@ -208,14 +209,17 @@ public class UserService extends BaseController {
                             inputStream = httpURLConnection.getInputStream();
 
                         }
-                        OSSClientUtil ossUtil =new OSSClientUtil();
-                        String[] arr = temp.split("/");
-                        String photoName = System.currentTimeMillis()+arr[arr.length-1];
-                        ossUtil.uploadFile2OSS(inputStream, Global.getPhoto(), photoName);
-                        user.setPhoto(Global.getAliyunUrl()+"/"+ Global.getPhoto() + photoName);
+                        String path = new StringBuilder("/headImg/")
+                                .append(userName+System.currentTimeMillis()).toString();
+                        BOSClientUtil bosClientUtil = new BOSClientUtil();
+                        String uploadPath = bosClientUtil.upload(path, inputStream);
+                        user.setPhoto(uploadPath);
+//                        OSSClientUtil ossUtil =new OSSClientUtil();
+//                        String[] arr = temp.split("/");
+//                        String photoName = System.currentTimeMillis()+arr[arr.length-1];
+//                        ossUtil.uploadFile2OSS(inputStream, Global.getPhoto(), photoName);
+//                        user.setPhoto(Global.getAliyunUrl()+"/"+ Global.getPhoto() + photoName);
                         FileUtils.delFile(Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL  +time);
-                    } catch (MalformedURLException e) {
-                        e.printStackTrace();
                     } catch (IOException e) {
                         e.printStackTrace();
                     } finally {

+ 6 - 6
src/main/java/com/jeeplus/modules/sys/web/UserController.java

@@ -562,11 +562,11 @@ public class UserController extends BaseController {
                             inputStream = httpURLConnection.getInputStream();
 
                         }
-                        OSSClientUtil ossUtil =new OSSClientUtil();
-                        String[] arr = temp.split("/");
-                        String photoName = System.currentTimeMillis()+arr[arr.length-1];
-                        ossUtil.uploadFile2OSS(inputStream, Global.getPhoto(), photoName);
-                        currentUser.setPhoto(Global.getAliyunUrl()+"/"+ Global.getPhoto() + photoName);
+                        String path = new StringBuilder("/headImg/")
+                                .append(currentUser.getName()+System.currentTimeMillis()).append(".png").toString();
+                        BOSClientUtil bosClientUtil = new BOSClientUtil();
+                        String uploadPath = bosClientUtil.upload(path, inputStream);
+                        currentUser.setPhoto(uploadPath);
                         FileUtils.delFile(Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL  +time);
                     } catch (MalformedURLException e) {
                         e.printStackTrace();
@@ -768,7 +768,7 @@ public class UserController extends BaseController {
         User currentUser = UserUtils.getUser();
         if(file != null && file.getSize()>0){
             String path = new StringBuilder("/headImg/")
-                    .append(currentUser.getName()).append(".png").toString();
+                    .append(currentUser.getName()+System.currentTimeMillis()).append(".png").toString();
             InputStream inputStream = file.getInputStream();
             BOSClientUtil bosClientUtil = new BOSClientUtil();
             String url = bosClientUtil.upload(path, inputStream);

+ 0 - 4
src/main/java/com/jeeplus/modules/workstaff/service/WorkStaffBasicInfoService.java

@@ -195,7 +195,6 @@ public class WorkStaffBasicInfoService extends CrudService<WorkStaffBasicInfoDao
         workStaffBasicInfo.setAchiveId(workStaffBasicInfo.getId());
         workStaffBasicInfo.setId(baseId);
 		super.save(workStaffBasicInfo);
-//        this.saveDetails(workStaffBasicInfo,false);
 	    //同步修改sys_user表中的name
         if(roleService.getRoleIdByUserId(workStaffBasicInfo.getUserId())!=null){
             //更新信息
@@ -213,9 +212,6 @@ public class WorkStaffBasicInfoService extends CrudService<WorkStaffBasicInfoDao
         }else{
             userService.insertRole(workStaffBasicInfo);
         }
-        //需要逻辑删除数据库中档案表id关联的教育经历等信息
-//        workStaffBasicInfo.setId(workStaffBasicInfo.getAchiveId());
-//        this.deleteDetailById(workStaffBasicInfo);
 	}
 
     /**

+ 1 - 1
src/main/java/com/jeeplus/modules/workstaff/web/WorkStaffBasicInfoController.java

@@ -229,7 +229,7 @@ public class WorkStaffBasicInfoController extends BaseController {
 			String path = new StringBuilder("/employeeImg/")
 			.append(workStaffBasicInfo.getName()).append(".png").toString();
 			InputStream inputStream = pictureFile.getInputStream();
-			BOSClientUtil bosClientUtil = new BOSClientUtil();
+            BOSClientUtil bosClientUtil = new BOSClientUtil();
 			String url = bosClientUtil.upload(path, inputStream);
             workStaffBasicInfo.setPicture(url);
 		}

+ 3 - 3
src/main/webapp/webpage/modules/workcontractinfo/workContractInfoForm.jsp

@@ -122,12 +122,12 @@
 					<td class="width-35">
 						<form:select path="contractType" class="form-control ">
 							<form:option value="0" label="请选择"/>
-							<form:option value="1" label="工程咨询"/>
+							<%--<form:option value="1" label="工程咨询"/>
 							<form:option value="2" label="工程审核"/>
 							<form:option value="3" label="招标代理"/>
 							<form:option value="4" label="跟踪审计"/>
-							<form:option value="5" label="其他"/>
-<%--<form:options items="${fns:getDictList('contract_category')}" itemLabel="label" itemValue="value" htmlEscape="false"/>--%>
+							<form:option value="5" label="其他"/>--%>
+<form:options items="${fns:getDictList('contract_info_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
 						</form:select>
 					</td>
 				</tr>