Browse Source

部门调转bug修复

user4 5 năm trước cách đây
mục cha
commit
8f29933f62

+ 10 - 2
src/main/java/com/jeeplus/modules/workofficechange/service/WorkOfficeChangeService.java

@@ -156,6 +156,7 @@ public class WorkOfficeChangeService extends CrudService<WorkOfficeChangeDao, Wo
 	@Transactional(readOnly = false)
 	public void updateWorkOfficeChangeList(WorkOfficeChange workOfficeChange) {
 		if (workOfficeChange.getWorkOfficeChangeUserList() != null && workOfficeChange.getWorkOfficeChangeUserList().size() > 0) {
+			String officeId = workOfficeChange.getChangeOffice();
             for (WorkOfficeChangeUser workOfficeChangeUser : workOfficeChange.getWorkOfficeChangeUserList()) {
 				if (StringUtils.isBlank(workOfficeChangeUser.getId())) {
 					if (StringUtils.isNotBlank(workOfficeChangeUser.getBasicInfoId())) {
@@ -188,10 +189,17 @@ public class WorkOfficeChangeService extends CrudService<WorkOfficeChangeDao, Wo
 				String userId = workOfficeChangeUser.getUserId();
 				String jobGradeId = workOfficeChangeUser.getJobGrade2().getId();
 				workStaffBasicInfoDao.updateJobGradeByUserId(userId,jobGradeId);
-				String officeId = workOfficeChangeUser.getOfficeId();
-				workStaffBasicInfoDao.updateOfficeByUserId(userId,officeId);
                 //新岗位
                 roleDao.updateRoleByUserId(workOfficeChange.getRoleId(),userId);
+				//新部门
+				workStaffBasicInfoDao.updateOfficeByUserId(userId,officeId);
+				//更新user表的officeId
+				User user =  new User();
+				user.setId(userId);
+                Office office = new Office();
+                office.setId(officeId);
+                user.setOffice(office);
+				userService.updateUser(user);
 			}
 		}
 	}

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

@@ -232,15 +232,6 @@ public class WorkStaffBasicInfoService extends CrudService<WorkStaffBasicInfoDao
         workStaffBasicInfo.setAchiveId(workStaffBasicInfo.getId());
         workStaffBasicInfo.setId(staffId);
         super.save(workStaffBasicInfo);
-//        this.saveDetails(workStaffBasicInfo,false);
-//        if (workStaffBasicInfo.getPhone() != null) {
-//            User user = new User();
-//            user.setId(workStaffBasicInfo.getUserId());
-//            user.setPhone(workStaffBasicInfo.getPhone());
-//            userService.updateUser(user);
-//        }
-        //需要逻辑删除数据库中员工id关联的教育经历等信息
-//        this.deleteDetailById(workStaffBasicInfo);
     }
     public void preSave(WorkStaffBasicInfo workStaffBasicInfo, HttpServletRequest request) throws IOException {
         if(workStaffBasicInfo.getCompany()==null){

+ 19 - 1
src/main/java/com/jeeplus/modules/workstaff/service/WorkStaffCertificateService.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.modules.workstaff.service;
 
+import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -14,6 +15,7 @@ import java.util.Map;
 
 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.oss.OSSClientUtil;
 import com.jeeplus.common.utils.DateUtils;
@@ -105,7 +107,7 @@ public class WorkStaffCertificateService extends CrudService<WorkStaffCertificat
         return flag;
     }
 
-    public String uploadFile(MultipartFile file, String filePath) {
+    /*public String uploadFile(MultipartFile file, String filePath) {
         if (file != null && !file.isEmpty() &&file.getSize()>0) {
             String key = "";
             if (StringUtils.isNotBlank(filePath)) {
@@ -141,6 +143,22 @@ public class WorkStaffCertificateService extends CrudService<WorkStaffCertificat
             }
         }
         return filePath;
+    }*/
+    public String uploadFile(MultipartFile file, String filePath){
+        String date = DateUtils.formatDate(new Date(),"yyMMddHHmm");
+        try {
+            if (file != null && file.getSize() > 0) {
+                String path = new StringBuilder("/employeeInfo/").append(date)
+                        .append(file.getOriginalFilename()).toString();
+                InputStream inputStream = file.getInputStream();
+                BOSClientUtil bosClientUtil = new BOSClientUtil();
+                String url = bosClientUtil.upload(path, inputStream);
+                return url;
+            }
+        }catch (Exception e){
+            logger.error("上传文件失败!");
+        }
+        return null;
     }
 
     public void query(WorkStaffBasicInfo workStaffBasicInfo) {

+ 0 - 38
src/main/java/com/jeeplus/modules/workstaff/service/WorkStaffEducationService.java

@@ -114,44 +114,6 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
         return flag;
     }
 
-//    public String uploadFile(MultipartFile file, String filePath) {
-//        if (file != null && !file.isEmpty() &&file.getSize()>0) {
-//            String key = "";
-//            if (StringUtils.isNotBlank(filePath)) {
-//                String aliyunUrl = Global.getAliyunUrl();
-//                String aliDownloadUrl = Global.getAliDownloadUrl();
-//                String cons = "";
-//                if (filePath.contains(aliyunUrl)) {
-//                    cons = aliyunUrl;
-//                } else if (filePath.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")) {
-//                    cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
-//                } else {
-//                    cons = aliDownloadUrl;
-//                }
-//                String[] arr = filePath.split(cons + "/");
-//                key = arr[1];
-//            }
-//            try {
-//                OSSClientUtil ossUtil1 = new OSSClientUtil();
-//                if (StringUtils.isNotBlank(key)) {
-//                    ossUtil1.deleteSingleObject(key);
-//                }
-//            }catch (Exception e){
-//                logger.error("oss删除文件失败!");
-//            }
-//            try {
-//                OSSClientUtil ossUtil = new OSSClientUtil();
-//                String path = Global.getStaffBasicFilePath()+ DateUtils.formatDate(new Date(),null)+"/";
-//                String newName = System.currentTimeMillis()+"-"+file.getOriginalFilename();
-//                ossUtil.uploadFile2OSS(file.getInputStream(),path,newName);
-//                return  Global.getAliDownloadUrl() + "/" + path + newName;
-//            } catch (Exception e) {
-//                logger.error("oss上传文件失败!");
-//            }
-//        }
-//        return filePath;
-//    }
-
     public String uploadFile(MultipartFile file, String filePath){
 	    String date = DateUtils.formatDate(new Date(),"yyMMddHHmm");
 	    try {

+ 15 - 34
src/main/java/com/jeeplus/modules/workstaff/service/WorkStaffTitleService.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.modules.workstaff.service;
 
+import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -14,6 +15,7 @@ import java.util.Map;
 
 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.oss.OSSClientUtil;
 import com.jeeplus.common.utils.DateUtils;
@@ -106,42 +108,21 @@ public class WorkStaffTitleService extends CrudService<WorkStaffTitleDao, WorkSt
         return flag;
     }
 
-    public String uploadFile(MultipartFile file, String filePath) {
-        if (file != null && !file.isEmpty() &&file.getSize()>0) {
-            String key = "";
-            if (StringUtils.isNotBlank(filePath)) {
-                String aliyunUrl = Global.getAliyunUrl();
-                String aliDownloadUrl = Global.getAliDownloadUrl();
-                String cons = "";
-                if (filePath.contains(aliyunUrl)) {
-                    cons = aliyunUrl;
-                } else if (filePath.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")) {
-                    cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
-                } else {
-                    cons = aliDownloadUrl;
-                }
-                String[] arr = filePath.split(cons + "/");
-                key = arr[1];
-            }
-            try {
-                OSSClientUtil ossUtil1 = new OSSClientUtil();
-                if (StringUtils.isNotBlank(key)) {
-                    ossUtil1.deleteSingleObject(key);
-                }
-            }catch (Exception e){
-                logger.error("oss删除文件失败!");
-            }
-            try {
-                OSSClientUtil ossUtil1 = new OSSClientUtil();
-                String path = Global.getStaffBasicFilePath()+ DateUtils.formatDate(new Date(),null)+"/";
-                String newName = System.currentTimeMillis()+"-"+file.getOriginalFilename();
-                ossUtil1.uploadFile2OSS(file.getInputStream(),path,newName);
-                return  Global.getAliDownloadUrl() + "/" + path + newName;
-            } catch (Exception e) {
-                logger.error("oss上传文件失败!");
+    public String uploadFile(MultipartFile file, String filePath){
+        String date = DateUtils.formatDate(new Date(),"yyMMddHHmm");
+        try {
+            if (file != null && file.getSize() > 0) {
+                String path = new StringBuilder("/employeeInfo/").append(date)
+                        .append(file.getOriginalFilename()).toString();
+                InputStream inputStream = file.getInputStream();
+                BOSClientUtil bosClientUtil = new BOSClientUtil();
+                String url = bosClientUtil.upload(path, inputStream);
+                return url;
             }
+        }catch (Exception e){
+            logger.error("上传文件失败!");
         }
-        return filePath;
+        return null;
     }
 
     public void query(WorkStaffBasicInfo workStaffBasicInfo) {

+ 15 - 34
src/main/java/com/jeeplus/modules/workstaff/service/WorkStaffTrainingService.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.modules.workstaff.service;
 
+import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -14,6 +15,7 @@ import java.util.Map;
 
 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.oss.OSSClientUtil;
 import com.jeeplus.common.utils.DateUtils;
@@ -106,42 +108,21 @@ public class WorkStaffTrainingService extends CrudService<WorkStaffTrainingDao,
         return flag;
     }
 
-    public String uploadFile(MultipartFile file, String filePath) {
-        if (file != null && !file.isEmpty() &&file.getSize()>0) {
-            String key = "";
-            if (StringUtils.isNotBlank(filePath)) {
-                String aliyunUrl = Global.getAliyunUrl();
-                String aliDownloadUrl = Global.getAliDownloadUrl();
-                String cons = "";
-                if (filePath.contains(aliyunUrl)) {
-                    cons = aliyunUrl;
-                } else if (filePath.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")) {
-                    cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
-                } else {
-                    cons = aliDownloadUrl;
-                }
-                String[] arr = filePath.split(cons + "/");
-                key = arr[1];
-            }
-            try {
-                OSSClientUtil ossUtil1 = new OSSClientUtil();
-                if (StringUtils.isNotBlank(key)) {
-                    ossUtil1.deleteSingleObject(key);
-                }
-            }catch (Exception e){
-                logger.error("oss删除文件失败!");
-            }
-            try {
-                OSSClientUtil ossUtil1 = new OSSClientUtil();
-                String path = Global.getStaffBasicFilePath()+ DateUtils.formatDate(new Date(),null)+"/";
-                String newName = System.currentTimeMillis()+"-"+file.getOriginalFilename();
-                ossUtil1.uploadFile2OSS(file.getInputStream(),path,newName);
-                return  Global.getAliDownloadUrl() + "/" + path + newName;
-            } catch (Exception e) {
-                logger.error("oss上传文件失败!");
+    public String uploadFile(MultipartFile file, String filePath){
+        String date = DateUtils.formatDate(new Date(),"yyMMddHHmm");
+        try {
+            if (file != null && file.getSize() > 0) {
+                String path = new StringBuilder("/employeeInfo/").append(date)
+                        .append(file.getOriginalFilename()).toString();
+                InputStream inputStream = file.getInputStream();
+                BOSClientUtil bosClientUtil = new BOSClientUtil();
+                String url = bosClientUtil.upload(path, inputStream);
+                return url;
             }
+        }catch (Exception e){
+            logger.error("上传文件失败!");
         }
-        return filePath;
+        return null;
     }
 
     public void query(WorkStaffBasicInfo workStaffBasicInfo) {