wkyy 3 éve
szülő
commit
38d27a6bda

+ 1 - 1
common/src/main/java/com/jpsoft/shinestar/modules/business/entity/RequestForLeaveInfo.java

@@ -72,7 +72,7 @@ public class RequestForLeaveInfo {
     @ApiModelProperty(value = "是否删除")
     private Boolean delFlag = false;
 
-    @ApiModelProperty(value = "状态 0-未处理,1-已批准,2-已退回,3-已拒绝")
+    @ApiModelProperty(value = "状态 -99-草稿,0-未处理,1-已批准,2-已退回,3-已拒绝")
     private Integer status;
 
     @ApiModelProperty(value = "审批意见")

+ 1 - 1
common/src/main/java/com/jpsoft/shinestar/modules/business/service/RequestForLeaveInfoService.java

@@ -32,7 +32,7 @@ public interface RequestForLeaveInfoService {
 
     void approvalRequestForLeave(PersonInfo personInfo, String id, String approvalOpinions, String approvalExplain, int status) throws Exception;
 
-    String leaveSubmit(PersonPopedom personPopedom, String type, String startTime, String endTime, String startTimeQuantum, String endTimeQuantum, String imageUrl, String reason, String days, String formId,String activityId) throws Exception;
+    String leaveSubmit(PersonPopedom personPopedom, String type, String startTime, String endTime, String startTimeQuantum, String endTimeQuantum, String imageUrl, String reason, String days, String formId,String activityId,String draft,String id) throws Exception;
 
 	List<RequestForLeaveInfo> findByPersonIdAndAttendanceDate(Long personId, Date attendanceDate);
 

+ 45 - 26
common/src/main/java/com/jpsoft/shinestar/modules/business/service/impl/RequestForLeaveInfoServiceImpl.java

@@ -514,15 +514,22 @@ public class RequestForLeaveInfoServiceImpl implements RequestForLeaveInfoServic
 	}
 
 	@Override
-	public String leaveSubmit(PersonPopedom personPopedom, String leaveType, String startTime, String endTime, String startTimeQuantum, String endTimeQuantum, String imageUrl, String reason, String days,String formId,String activity) throws Exception{
+	public String leaveSubmit(PersonPopedom personPopedom, String leaveType, String startTime, String endTime, String startTimeQuantum, String endTimeQuantum, String imageUrl, String reason, String days,String formId,String activity,String draft,String id) throws Exception{
 
 
 
 		try{
 
 
-			RequestForLeaveInfo requestForLeaveInfo = new RequestForLeaveInfo();
-			requestForLeaveInfo.setId(UUID.randomUUID().toString());
+			RequestForLeaveInfo  requestForLeaveInfo = null;
+			if(StringUtils.isNotEmpty(id)){
+				requestForLeaveInfo=requestForLeaveInfoDAO.get(id);
+
+			}else{
+					requestForLeaveInfo=new RequestForLeaveInfo();
+				requestForLeaveInfo.setId(UUID.randomUUID().toString());
+			}
+
 			requestForLeaveInfo.setLeaveType(leaveType);
 
 			String startTimeStr =  DateUtil.format(DateUtil.parse(startTime),"yyyy-MM-dd");
@@ -556,16 +563,28 @@ public class RequestForLeaveInfoServiceImpl implements RequestForLeaveInfoServic
 			requestForLeaveInfo.setPersonId(personPopedom.getPersonId());
 			requestForLeaveInfo.setPersonPopedomId(personPopedom.getId());
 			requestForLeaveInfo.setCreateTime(new Date());
-			requestForLeaveInfo.setStatus(0);
+
+			if (draft == "1") {
+				requestForLeaveInfo.setStatus(0);
+
+			}else{
+				requestForLeaveInfo.setStatus(-99);
+
+			}
 			requestForLeaveInfo.setStartTimeQuantum(startTimeQuantum);
 			requestForLeaveInfo.setEndTimeQuantum(endTimeQuantum);
 			requestForLeaveInfo.setDays(days);
-			insert(requestForLeaveInfo);
+			if(StringUtils.isNotEmpty(id)){
 
-			String id = requestForLeaveInfo.getId();
+				update(requestForLeaveInfo);
+			}else {
+				insert(requestForLeaveInfo);
+			}
 
+			String ide = requestForLeaveInfo.getId();
 
-			String procinstId = procinstService.addProcinst(id,days,"请假",formId,personPopedom,activity);
+			if (draft == "1") {
+			String procinstId = procinstService.addProcinst(ide,days,"请假",formId,personPopedom,activity);
 
 
 			requestForLeaveInfo.setProcinstId(procinstId);
@@ -576,31 +595,31 @@ public class RequestForLeaveInfoServiceImpl implements RequestForLeaveInfoServic
 
 				ProcinstActivity procinstActivity = procinstActivityService.findByActivityIndexAndProcinstId(1, procinstId);
 
-				if (procinstActivity != null) {
-					List<ProcinstActUser> procinstActUserList = procinstActUserService.findByProcinstActivityIdActionType(procinstActivity.getId(), "0", "1");
-					if (procinstActUserList.size() > 0) {
 
-						new Thread(() -> {
-						for (ProcinstActUser procinstActUser : procinstActUserList) {
-							try{
-								PersonInfo personInfo = personInfoService.get(Long.parseLong(procinstActUser.getUserId()));
-
-								//提交人
-								PersonInfo personInfo1 = personInfoService.get(personPopedom.getPersonId());
-								String accessToken = JwtUtil2.createToken(jwtSecret, personInfo.getId() + "", DateTime.now().plusHours(30 * 24).toDate());
-								WechatMessageUtil.sendEvenMessage(personInfo.getOpenId(), "有一条新的请假信息待审核", personInfo1.getName(), com.jpsoft.shinestar.modules.common.utils.StringUtils.getApprovalNo(), "前往处理", wxConfig.getPortalUrl() + "xsy/approval/infosp?id=" + id + "&procinstActUserId=" + procinstActUser.getId() + "&formId=" + formId + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
-							}catch (Exception ex){
-								ex.printStackTrace();
-							}
+					if (procinstActivity != null) {
+						List<ProcinstActUser> procinstActUserList = procinstActUserService.findByProcinstActivityIdActionType(procinstActivity.getId(), "0", "1");
+						if (procinstActUserList.size() > 0) {
+
+							new Thread(() -> {
+								for (ProcinstActUser procinstActUser : procinstActUserList) {
+									try {
+										PersonInfo personInfo = personInfoService.get(Long.parseLong(procinstActUser.getUserId()));
+
+										//提交人
+										PersonInfo personInfo1 = personInfoService.get(personPopedom.getPersonId());
+										String accessToken = JwtUtil2.createToken(jwtSecret, personInfo.getId() + "", DateTime.now().plusHours(30 * 24).toDate());
+										WechatMessageUtil.sendEvenMessage(personInfo.getOpenId(), "有一条新的请假信息待审核", personInfo1.getName(), com.jpsoft.shinestar.modules.common.utils.StringUtils.getApprovalNo(), "前往处理", wxConfig.getPortalUrl() + "xsy/approval/infosp?id=" + id + "&procinstActUserId=" + procinstActUser.getId() + "&formId=" + formId + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
+									} catch (Exception ex) {
+										ex.printStackTrace();
+									}
 
+								}
+							}).start();
 						}
-					}).start();
 					}
 				}
 
-
-
-			return  id;
+			return  ide;
 
 		}catch (Exception ex){
 			throw new Exception(ex.getMessage());

+ 3 - 0
common/src/main/java/com/jpsoft/shinestar/modules/common/utils/TypeNameUtil.java

@@ -130,6 +130,9 @@ public class TypeNameUtil {
         if ("6".equals(status)){
             examineTypeName = "已撤销";
         }
+        if ("-99".equals(status)){
+            examineTypeName = "草稿";
+        }
         return examineTypeName;
     }
 

+ 5 - 4
web/src/main/java/com/jpsoft/shinestar/modules/mobile/controller/RequestForLeaveController.java

@@ -355,9 +355,10 @@ public class RequestForLeaveController {
             @ApiImplicitParam(name = "reason", value = "请假理由", required = true, paramType = "form"),
             @ApiImplicitParam(name = "days", value = "天数", required = true, paramType = "form"),
             @ApiImplicitParam(name = "formId", value = "页面路径", required = true, paramType = "form"),
-            @ApiImplicitParam(name = "activityId", value = "步骤id", required = true, paramType = "form")
+            @ApiImplicitParam(name = "activityId", value = "步骤id", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "draft", value = "状态(0:草稿,1:提交)", required = true, paramType = "form")
     })
-    public MessageResult<Map> leaveSubmit(String leaveType, String startTime, String endTime, String startTimeQuantum,String endTimeQuantum,String imageUrl,String reason,String days,String formId,String activityId,String token, @RequestAttribute String subject) {
+    public MessageResult<Map> leaveSubmit(String id,String draft,String leaveType, String startTime, String endTime, String startTimeQuantum,String endTimeQuantum,String imageUrl,String reason,String days,String formId,String activityId,String token, @RequestAttribute String subject) {
 
 
         MessageResult<Map> messageResult = new MessageResult<>();
@@ -366,10 +367,10 @@ public class RequestForLeaveController {
             PersonInfo person = personInfoService.get(Long.parseLong(subject));
             PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
 
-            String id = requestForLeaveInfoService.leaveSubmit(personPopedom, leaveType,startTime,endTime, startTimeQuantum, endTimeQuantum, imageUrl,reason,days,formId,activityId);
+            String ide = requestForLeaveInfoService.leaveSubmit(personPopedom, leaveType,startTime,endTime, startTimeQuantum, endTimeQuantum, imageUrl,reason,days,formId,activityId,draft,id);
 
             Map<String, Object> map = new HashMap<>();
-            map.put("id", id);
+            map.put("id", ide);
             messageResult.setData(map);
             messageResult.setCode(200);
             messageResult.setResult(true);