LiGuang 2 سال پیش
والد
کامیت
abab597207

+ 277 - 70
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/controller/UserShiftController.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.geke.userShift.controller;
 
+import java.lang.reflect.Field;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -11,7 +13,9 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.ImportExcelUtil;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.geke.statutoryleave.service.IStatutoryLeaveService;
 import org.jeecg.modules.geke.userShift.entity.UserShift;
 import org.jeecg.modules.geke.userShift.entity.UserShiftExcel;
 import org.jeecg.modules.geke.userShift.entity.UserShiftVo;
@@ -27,6 +31,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -49,6 +54,9 @@ import io.swagger.annotations.ApiOperation;
 public class UserShiftController extends JeecgController<UserShift, IUserShiftService> {
 	@Autowired
 	private IUserShiftService userShiftService;
+
+	@Autowired
+	private IStatutoryLeaveService statutoryLeaveService;
 	
 	/**
 	 * 分页列表查询
@@ -175,34 +183,35 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
       return super.exportXls(request, userShift, UserShift.class, "员工排班");
   }
 
-	  /**
-	   * 通过excel导入数据
-	   *
-	   * @param request
-	   * @param response
-	   * @return
-	   */
-	  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-	  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-		  MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-		  Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-		  for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-			  MultipartFile file = entity.getValue();// 获取上传文件对象
-			  ImportParams params = new ImportParams();
-			  params.setTitleRows(2);
-			  params.setHeadRows(1);
-			  params.setNeedSave(true);
-			  try {
-			  	List<UserShift>ls=new ArrayList<>();
-				  List<UserShiftExcel> list = ExcelImportUtil.importExcel(file.getInputStream(), UserShiftExcel.class, params);
-				  for(UserShiftExcel o:list){
+
+	 /**
+	  * 通过excel导入数据
+	  *
+	  * @param request
+	  * @param response
+	  * @return
+	  */
+	 @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+	 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+		 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+		 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+		 for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+			 MultipartFile file = entity.getValue();// 获取上传文件对象
+			 ImportParams params = new ImportParams();
+			 params.setTitleRows(2);
+			 params.setHeadRows(1);
+			 params.setNeedSave(true);
+			 try {
+				 List<UserShift>ls=new ArrayList<>();
+				 List<UserShiftExcel> list = ExcelImportUtil.importExcel(file.getInputStream(), UserShiftExcel.class, params);
+				 for(UserShiftExcel o:list){
 					 if (oConvertUtils.isNotEmpty(o.getWorkNo())&&oConvertUtils.isNotEmpty(o.getMoth())){
-						 String userId = userShiftService.getUserId(o.getWorkNo());
-						 userShiftService.deleteUserShift(userId,o.getMoth()+"-01");
+						 Map<String,Object> userId = userShiftService.getUserId(o.getWorkNo());
+						 userShiftService.deleteUserShift(userId.get("id").toString(),o.getMoth()+"-01");
 						 if (oConvertUtils.isNotEmpty(userId)) {
 							 if (oConvertUtils.isNotEmpty(o.getA1())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-01","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA1());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA1().equals("休")) {
@@ -215,7 +224,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA2())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-02","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA2());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA2().equals("休")) {
@@ -228,7 +237,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA3())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-03","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA3());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA3().equals("休")) {
@@ -241,7 +250,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA4())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-04","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA4());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA4().equals("休")) {
@@ -254,7 +263,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA5())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-05","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA5());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA5().equals("休")) {
@@ -267,7 +276,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA6())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-06","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA6());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA6().equals("休")) {
@@ -280,7 +289,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA7())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-07","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA7());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA7().equals("休")) {
@@ -293,7 +302,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA8())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-08","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA8());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA8().equals("休")) {
@@ -306,7 +315,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA9())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-09","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA9());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA9().equals("休")) {
@@ -319,7 +328,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA10())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-10","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA10());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA10().equals("休")) {
@@ -332,7 +341,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA11())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-11","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA11());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA11().equals("休")) {
@@ -345,7 +354,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA12())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-12","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA12());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA12().equals("休")) {
@@ -358,7 +367,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA13())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-13","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA13());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA13().equals("休")) {
@@ -371,7 +380,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA14())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-14","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA14());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA14().equals("休")) {
@@ -384,7 +393,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA15())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-15","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA15());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA15().equals("休")) {
@@ -397,7 +406,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA16())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-16","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA16());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA16().equals("休")) {
@@ -410,7 +419,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA17())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-17","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA17());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA17().equals("休")) {
@@ -423,7 +432,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA18())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-18","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA18());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA18().equals("休")) {
@@ -436,7 +445,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA19())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-19","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA19());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA19().equals("休")) {
@@ -449,7 +458,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA20())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-20","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA20());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA20().equals("休")) {
@@ -462,7 +471,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA21())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-21","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA21());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA21().equals("休")) {
@@ -475,7 +484,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA22())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-22","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA22());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA22().equals("休")) {
@@ -488,7 +497,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA23())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-23","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA23());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA23().equals("休")) {
@@ -501,7 +510,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA23())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-23","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA23());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA23().equals("休")) {
@@ -514,7 +523,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA24())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-24","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA24());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA24().equals("休")) {
@@ -527,7 +536,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA25())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-25","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA25());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA25().equals("休")) {
@@ -540,7 +549,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA26())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-26","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA26());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA26().equals("休")) {
@@ -553,7 +562,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA27())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-27","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA27());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA27().equals("休")) {
@@ -566,7 +575,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA28())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-28","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA28());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA28().equals("休")) {
@@ -579,7 +588,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA30())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-30","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA30());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA30().equals("休")) {
@@ -592,7 +601,7 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 								 ls.add(u);
 							 }if (oConvertUtils.isNotEmpty(o.getA31())) {
 								 UserShift u = new UserShift();
-								 u.setUserId(userId);
+								 u.setUserId(userId.get("id").toString());
 								 u.setShiftDate(DateUtils.parseDate(o.getMoth()+"-31","yyyy-MM-dd"));
 								 String shiftId = userShiftService.getShiftId(o.getA31());
 								 if (oConvertUtils.isNotEmpty(shiftId)&&!o.getA31().equals("休")) {
@@ -606,17 +615,193 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 							 }
 						 }
 					 }
+				 }
+				 if (ls.size()>0){
+					 userShiftService.saveBatch(ls);
+				 }
+				 //update-begin-author:taoyan date:20190528 for:批量插入数据
+				 long start = System.currentTimeMillis();
+				 //400条 saveBatch消耗时间1592毫秒  循环插入消耗时间1947毫秒
+				 //1200条  saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
+				 log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
+				 //update-end-author:taoyan date:20190528 for:批量插入数据
+				 return Result.ok("文件导入成功!数据行数:" + ls.size());
+			 } catch (Exception e) {
+				 log.error(e.getMessage(), e);
+				 return Result.error("文件导入失败:" + e.getMessage());
+			 } finally {
+				 try {
+					 file.getInputStream().close();
+				 } catch (IOException e) {
+					 e.printStackTrace();
+				 }
+			 }
+		 }
+		 return Result.error("文件导入失败!");
+	 }
+	  /**
+	   * 通过excel导入数据
+	   *
+	   * @param request
+	   * @param response
+	   * @return
+	   */
+	/*  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+	  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException {
+		  MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+		  Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+		  int index=0;
+		  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
+		  SimpleDateFormat sd = new SimpleDateFormat("dd");
+		  List<UserShift>ls=new ArrayList<>();
+		  List<String>errs=new ArrayList<>();
+		  List<String>us=new ArrayList<>();
+		  for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+			  MultipartFile file = entity.getValue();// 获取上传文件对象
+			  ImportParams params = new ImportParams();
+			  params.setTitleRows(2);
+			  params.setHeadRows(1);
+			  params.setNeedSave(true);
+			  try {
+				  List<UserShiftExcel> list = ExcelImportUtil.importExcel(file.getInputStream(), UserShiftExcel.class, params);
+				  for(UserShiftExcel o:list){
+				  		index++;
+					  if (oConvertUtils.isNotEmpty(o.getWorkNo())&&oConvertUtils.isNotEmpty(o.getMoth())){
+						  Map<String,Object> userId = userShiftService.getUserId(o.getWorkNo());
+						  if (userId.size()>0) {
+						  	us.add(userId.get("id").toString()+","+o.getMoth() + "-01");
+							  Map<String, Object> dataMap = objectToMap(o);
+							  Calendar calendar = Calendar.getInstance();
+							  calendar.setTime(DateUtils.parseDate(o.getMoth() + "-01", "yyyy-MM-dd"));
+							  int actualMaximum = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
+							  for (int i = 1; i <= actualMaximum; i++) {//循环获取时间月份的总天数
+								  List<String> lst = new ArrayList<>();
+								  Integer sum = 0;
+								  Integer xsum = 0;
+								  int day = DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd").getDay();
+								  if (DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd").getDay() == 1) {
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 0));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 3));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 4));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 5));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 6));
+								  } else if (DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd").getDay() == 2) {
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 0));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 3));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 4));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 5));
+
+								  } else if (DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd").getDay() == 3) {
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 0));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 3));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 4));
+
+								  } else if (DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd").getDay() == 4) {
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -3));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 0));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 3));
+								  } else if (DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd").getDay() == 5) {
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -4));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -3));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 0));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 2));
+
+								  } else if (DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd").getDay() == 6) {
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -5));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -4));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -3));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 0));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 1));
+
+								  } else if (DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd").getDay() == 0) {
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -6));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -5));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -4));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -3));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -2));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, -1));
+									  lst.add(this.getDay(o.getMoth() + "-" + i, 0));
+								  }
+								  List<String> dates = new ArrayList<>();
+								  List<String> it = new ArrayList<>();
+								  for (int is = 0; is < lst.size(); is++) {
+									  if (!sdf.format(DateUtils.parseDate(lst.get(is), "yyyy-MM-dd")).equals(sdf.format(DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd")))) {
+										  dates.add(lst.get(is));
+										  it.add(lst.get(is));
+									  }
+								  }
+								  lst.removeAll(it);
+								  if (dates.size() > 0) {
+									  Map<String, Integer> map = userShiftService.shiftCount(dates, userId.get("id").toString());
+									  sum += map.get("count");
+									  xsum += map.get("counts");
+								  }
+								  for (String s : lst) {
+									  List<String> leavs = statutoryLeaveService.getList(s);
+									  Object os = dataMap.get("a" + s.split("-")[1]);
+									  if (os != null && os.equals("法") && leavs == null) {
+										  errs.add("第" + index + "行,排班有误");
+										  break;
+									  } else if (os != null) {
+										  if (!os.equals("休")) {
+											  xsum++;
+										  } else {
+											  sum++;
+										  }
+									  }
+								  }
+								  if (userId.get("category").equals("106")) {
+									  if (xsum > 6 || sum > 1) {
+										  errs.add("第" + index + "行,排班有误");
+										  break;
+									  }
+								  } else {
+									  if (xsum > 5 || sum > 2) {
+										  errs.add("第" + index + "行,排班有误");
+										  break;
+									  }
+								  }
+								  if (oConvertUtils.isNotEmpty(dataMap.get("a" + i))) {
+									  UserShift u = new UserShift();
+									  u.setUserId(userId.get("id").toString());
+									  u.setShiftDate(DateUtils.parseDate(o.getMoth() + "-" + i, "yyyy-MM-dd"));
+									  if (oConvertUtils.isNotEmpty(dataMap.get("a" + i)) && !dataMap.get("a" + i).equals("休") && !dataMap.get("a" + i).equals("法")) {
+										  String shiftId = userShiftService.getShiftId(dataMap.get("a" + i).toString());
+										  if (oConvertUtils.isNotEmpty(shiftId)) {
+											  u.setShiftId(shiftId);
+										  }
+									  } else if (oConvertUtils.isNotEmpty(dataMap.get("a" + i)) && dataMap.get("a" + i).equals("法")) {
+										  u.setShiftId("1");
+									  } else if (oConvertUtils.isNotEmpty(dataMap.get("a" + i)) && dataMap.get("a" + i).equals("休")) {
+										  u.setShiftId("0");
+									  }
+									  ls.add(u);
+								  }
+							  }
+
+
+						  }
+					  }
 				  }
-				if (ls.size()>0){
-					userShiftService.saveBatch(ls);
-				}
-				  //update-begin-author:taoyan date:20190528 for:批量插入数据
-				  long start = System.currentTimeMillis();
-				  //400条 saveBatch消耗时间1592毫秒  循环插入消耗时间1947毫秒
-				  //1200条  saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
-				  log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
-				  //update-end-author:taoyan date:20190528 for:批量插入数据
-				  return Result.ok("文件导入成功!数据行数:" + ls.size());
+
 			  } catch (Exception e) {
 				  log.error(e.getMessage(), e);
 				  return Result.error("文件导入失败:" + e.getMessage());
@@ -628,8 +813,17 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 				  }
 			  }
 		  }
-		  return Result.error("文件导入失败!");
-	  }
+
+		  if (errs.size()<1){
+		  	if (us.size()>0) {
+				for (String u : us) {
+				userShiftService.deleteUserShift(u.split(",")[0], u.split(",")[1]);
+				}
+			userShiftService.saveBatch(ls);
+			}
+		  }
+		  return Result.error("文件导入失败");
+	  }*/
 
 
 	 @GetMapping(value = "/UserShiftType")
@@ -645,15 +839,28 @@ public class UserShiftController extends JeecgController<UserShift, IUserShiftSe
 	 }
 
 
-	 public String getDay(String date,Integer day){
-		 Date today = new Date(date);
+	 public String getDay(String date,Integer day) throws ParseException {
+		 SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
+		 Date today = DateUtils.parseDate(date, "yyyy-MM-dd");
 		 Long targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
 		 today.setTime(targetday_milliseconds); //注意,这行是关键代码
-		 int tYear = today.getYear();
 		 int tMonth = today.getMonth() + 1;
 		 int tDate = today.getDate();
-		 return tYear + "-" + tMonth + "-" + tDate;
+		 return sdf.format(today)+ "-" + tMonth + "-" + tDate;
 	 }
 
+	 public static Map<String, Object> objectToMap(Object object){
+		 Map<String,Object> dataMap = new HashMap<>();
+		 Class<?> clazz = object.getClass();
+		 for (Field field : clazz.getDeclaredFields()) {
+			 try {
+				 field.setAccessible(true);
+				 dataMap.put(field.getName(),field.get(object));
+			 } catch (IllegalAccessException e) {
+				 e.printStackTrace();
+			 }
+		 }
+		 return dataMap;
+	 }
 
 }

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/mapper/UserShiftMapper.java

@@ -65,7 +65,7 @@ public interface UserShiftMapper extends BaseMapper<UserShift> {
     //统计每月班次有多少次人员排班
    Map<String,Object>ShiftCount(@Param("id")String id,@Param("date")String date,@Param("deptids")List<String>deptids,@Param("realname")String realname,@Param("deptid")String deptid);
 
-  String getUserId(@Param("code")String code);
+    Map<String,Object> getUserId(@Param("code")String code);
 
   String getShiftId(@Param("name")String name);
 

+ 2 - 2
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/mapper/xml/UserShiftMapper.xml

@@ -219,8 +219,8 @@ order by a.shift_date desc
         </if>
         order by date_format(b.start_date,'%H:%i:%s') asc
     </select>
-    <select id="getUserId" resultType="java.lang.String">
-        select id from sys_user where 1=1
+    <select id="getUserId" resultType="java.util.Map">
+        select id,category from sys_user where 1=1
         <if test="code!=null and ''!=code">
             and work_no=#{code}
         </if>

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/service/IUserShiftService.java

@@ -51,7 +51,7 @@ public interface IUserShiftService extends IService<UserShift> {
 
     String getUserShiftType(String date,String userid);
 
-    String getUserId(String code);
+    Map<String,Object> getUserId(String code);
 
     String getShiftId(String name);
 

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/service/impl/UserShiftServiceImpl.java

@@ -328,7 +328,7 @@ public class UserShiftServiceImpl extends ServiceImpl<UserShiftMapper, UserShift
     }
 
     @Override
-    public String getUserId(String code) {
+    public Map<String,Object>  getUserId(String code) {
         return userShiftMapper.getUserId(code);
     }
 

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userquit/mapper/xml/UserQuitMapper.xml

@@ -26,7 +26,7 @@
     </delete>
     <select id="list" resultType="org.jeecg.modules.geke.userquit.entity.UserQuit">
         select a.user_name,a.id,b.work_no as 'workNo',b.category as 'category',b.sfz_code as 'sfzCode',b.entry_Date as 'entryDate',
-        a.dept,a.new_Date,a.post,b.post as 'posts',a.remarks,a.state,d.org_code as 'orgCode',a.status,a.sy_state,b.id as 'userId'
+        a.dept,a.new_Date,a.post,b.post as 'posts',a.remarks,a.state,d.org_code as 'orgCode',a.status,a.sy_state,b.id as 'userId',a.sp_name
         from geke_user_quit a
         left join sys_user  b on a.user_id=b.id
         left join sys_user_depart c on b.id=c.user_id

+ 47 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -216,6 +216,7 @@ public class SysUserController {
      * @param req
      * @return
      */
+    @AutoLog(value = "员工管理-员工列表查询")
     @PermissionData(pageComponent = "system/UserLists")
     @RequestMapping(value = "/lists", method = RequestMethod.GET)
     public  List<SysUser> queryPageList(String username,String date,String depid) throws ParseException {
@@ -312,6 +313,7 @@ public class SysUserController {
      * @param req
      * @return
      */
+    @AutoLog(value = "员工管理-员工列表查询")
     @PermissionData(pageComponent = "system/UserList")
 	@RequestMapping(value = "/list", method = RequestMethod.GET)
 	public Result<IPage<SysUser>> queryPageList(SysUser user,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@@ -442,6 +444,7 @@ public class SysUserController {
 
     //@RequiresRoles({"admin"})
     //@RequiresPermissions("user:add")
+    @AutoLog(value = "员工管理-新增")
 	@RequestMapping(value = "/add", method = RequestMethod.POST)
 	public Result<SysUser> add(@RequestBody JSONObject jsonObject) {
 		Result<SysUser> result = new Result<SysUser>();
@@ -524,6 +527,7 @@ public class SysUserController {
 
     //@RequiresRoles({"admin"})
     //@RequiresPermissions("user:edit")
+    @AutoLog(value = "员工管理-编辑")
 	@RequestMapping(value = "/edit", method = RequestMethod.PUT)
 	public Result<SysUser> edit(@RequestBody JSONObject jsonObject) {
 		Result<SysUser> result = new Result<SysUser>();
@@ -2663,6 +2667,7 @@ public class SysUserController {
         return Result.OK(pageList);
     }
 
+    @AutoLog(value = "排班-查询排班信息")
     @GetMapping(value = "/queryMothByUser")
     public Result<?> queryMothByUser(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                      @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@@ -2712,7 +2717,7 @@ public class SysUserController {
         return Result.OK(maps);
     }
 
-
+    @AutoLog(value = "排班-编辑排班")
     @GetMapping(value = "/queryMothByUsers")
     public Result<?> queryMothByUsers(HttpServletRequest req, UserShift userShift,String deptid,String usertid,String type) throws ParseException {
         List<Map<String, Object>> maps = userShiftService.mothUserShifts(DateUtils.formatDate(userShift.getShiftDate()), type, usertid);
@@ -2726,6 +2731,7 @@ public class SysUserController {
         return Result.OK(maps);
     }
 
+    @AutoLog(value = "排班-排班统计")
     @RequestMapping(value = "/queryMothByCount", method = RequestMethod.GET)
     public Result<?> queryMothByCount(UserShift userShift,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                       @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@@ -2825,6 +2831,7 @@ public class SysUserController {
      * @param response
      * @return
      */
+    @AutoLog(value = "员工管理-薪资导入")
     @RequestMapping(value = "/importExcels", method = RequestMethod.POST)
     public Result<?> importExcels(HttpServletRequest request, HttpServletResponse response) {
 
@@ -2981,8 +2988,8 @@ public class SysUserController {
      * @param userQuit
      * @return
      */
-    @AutoLog(value = "入职,离职信息-编辑")
-    @ApiOperation(value="入职,离职信息-编辑", notes="入职,离职信息-编辑")
+    @AutoLog(value = "入职,离职信息-变更/删除企业微信")
+    @ApiOperation(value="入职,离职信息-变更/删除企业微信", notes="入职,离职信息-变更/删除企业微信")
     @PutMapping(value = "/userQuitEdit")
     public Result<?> userQuitEdit(@RequestBody UserQuit userQuit) throws IOException, ParseException {
         if (oConvertUtils.isNotEmpty(userQuit.getState())&&userQuit.getState()==3){
@@ -2999,4 +3006,41 @@ public class SysUserController {
         }
         return Result.OK("编辑成功!");
     }
+
+
+    /**
+     * 编辑
+     *
+     * @param userChage
+     * @return
+     */
+    @AutoLog(value = "员工管理-变更社会工龄")
+    @ApiOperation(value="员工管理-变更社会工龄", notes="员工管理-变更社会工龄")
+    @PutMapping(value = "/editWorkMoth")
+    public Result<?> editWorkMoth(@RequestBody SysUser sysUser)  {
+        if (oConvertUtils.isNotEmpty(sysUser.getId())&&oConvertUtils.isNotEmpty(sysUser.getWorkMoth())){
+            sysUserService.editWorkMoth(sysUser.getId(),sysUser.getWorkMoth());
+            return Result.OK("变更成功!");
+        }
+        return Result.error("参数缺失!");
+    }
+
+
+
+    /**
+     * 编辑
+     *
+     * @param userChage
+     * @return
+     */
+    @AutoLog(value = "员工管理-异常离职")
+    @ApiOperation(value="员工管理-异常离职", notes="员工管理-异常离职")
+    @PutMapping(value = "/editQuit")
+    public Result<?> editQuit(@RequestBody SysUser sysUser)  {
+        if (oConvertUtils.isNotEmpty(sysUser.getId())&&oConvertUtils.isNotEmpty(sysUser.getNewDate())){
+            sysUserService.editQuit(sysUser);
+            return Result.OK("操作成功!");
+        }
+        return Result.error("参数缺失!");
+    }
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java

@@ -15,6 +15,8 @@ import org.jeecg.modules.system.vo.CodeVo;
 import org.jeecg.modules.system.vo.DepartTreeVo;
 import org.jeecg.modules.system.vo.SysUserDepVo;
 
+import javax.xml.crypto.Data;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -235,5 +237,9 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
 
 	//查询手机号是否存在
 	int countPhone(@Param("phone")String phone,@Param("userid")String userid);
+	//变更人员工龄
+	boolean editWorkMoth(@Param("userid")String userid,@Param("sum")String sum);
+	//非正常离职变更
+	boolean editQuit(@Param("userid")String userid,@Param("date") Date date);
 
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml

@@ -195,6 +195,12 @@
 	<update id="updateTUUser">
 		update sys_user set u_state="1" where id=#{userid}
 	</update>
+	<update id="editWorkMoth">
+		update sys_user set work_Moth=#{sum} where id=#{userid}
+	</update>
+	<update id="editQuit">
+		update sys_user set employment_status='30',term_date=#{date} where id=#{userid}
+	</update>
 
 
 	<!-- 通过多个部门IDS,查询部门下的用户信息 -->

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java

@@ -324,4 +324,8 @@ List<String>  departIds(String userid);
 
 	List<String>emails(String email,String userid);
 
+	boolean editWorkMoth(String userid,String sum);
+
+	boolean editQuit(SysUser sysUser);
+
 }

+ 40 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java

@@ -21,10 +21,13 @@ import org.jeecg.common.util.UUIDGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.geke.teams.entity.Teams;
 import org.jeecg.modules.geke.teams.service.ITeamsService;
+import org.jeecg.modules.geke.userquit.entity.UserQuit;
+import org.jeecg.modules.geke.userquit.service.IUserQuitService;
 import org.jeecg.modules.system.entity.*;
 import org.jeecg.modules.system.mapper.*;
 import org.jeecg.modules.system.model.SysUserSysDepartModel;
 import org.jeecg.modules.system.service.ISysDepartService;
+import org.jeecg.modules.system.service.ISysPositionService;
 import org.jeecg.modules.system.service.ISysUserRoleService;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.system.util.UrlData;
@@ -78,12 +81,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 	@Resource
 	private BaseCommonService baseCommonService;
 
+	@Autowired
+	private IUserQuitService userQuitService;
+
 	@Autowired
 	private ISysUserRoleService sysUserRoleService;
 
 	@Autowired
 	private ITeamsService teamsService;
 
+	@Autowired
+	private ISysPositionService sysPositionService;
+
 	@Override
 	public List<SysUser> queryEmpByLeave(String username, String depid) {
 		return userMapper.queryEmpByLeave(username,depid);
@@ -660,6 +669,37 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 		return userMapper.emails(email,userid);
 	}
 
+	@Override
+	public boolean editWorkMoth(String userid, String sum) {
+		return userMapper.editWorkMoth(userid,sum);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean editQuit(SysUser sysUser) {
+		UserQuit userQuit=new UserQuit();
+		userQuit.setUserId(sysUser.getId());
+		userQuit.setNewDate(sysUser.getNewDate());
+		userQuit.setUserName(sysUser.getRealname());
+		userQuit.setSpName("异常离职");
+		userQuit.setApplyTime(new Date());
+		userQuit.setStatus(1);
+		userQuit.setState(1);
+		List<SysDepart> sysDeparts = sysDepartService.queryUserDeparts(sysUser.getId());
+		if (oConvertUtils.isNotEmpty(sysDeparts)&&sysDeparts.size()>0){
+			userQuit.setDept(sysDeparts.get(0).getDepartName());
+			userQuit.setDeptId(sysDeparts.get(0).getId());
+		}
+		if (oConvertUtils.isNotEmpty(sysUser.getPost())) {
+			SysPosition ones = sysPositionService.getOnes(sysUser.getPost());
+			userQuit.setPost(ones.getName());
+		}if (oConvertUtils.isNotEmpty(sysUser.getDemo())){
+			userQuit.setRemarks(sysUser.getDemo());
+		}
+		userQuitService.save(userQuit);
+		return userMapper.editQuit(sysUser.getId(),sysUser.getNewDate());
+	}
+
 
 	/**
 	 * 循环获取字典数据 树