wkyy vor 3 Jahren
Ursprung
Commit
8401bde71b

+ 1 - 1
common/src/main/java/com/jpsoft/shinestar/modules/base/entity/BusinessOut.java

@@ -42,7 +42,7 @@ public class BusinessOut {
     private String content;
     @ApiModelProperty(value = "审批人id")
     private String approvalPersonPopedomId;
-    @ApiModelProperty(value = "审批状态: 0:待处理,1:同意,2:退回,3:拒绝")
+    @ApiModelProperty(value = "审批状态: -99:草稿,0:待处理,1:同意,2:退回,3:拒绝")
     private String status;
     @ApiModelProperty(value = "审批编号")
     private String approvalNo;

+ 1 - 1
common/src/main/java/com/jpsoft/shinestar/modules/base/service/BusinessOutService.java

@@ -26,7 +26,7 @@ public interface BusinessOutService {
 
     List<BusinessOut> findByPersonIdAndDate(Long personId, Date attendanceDate);
 
-    String submitBusiness(PersonPopedom personPopedom, String type, String destination, String startTime,String endTime,String days, String estimatedTime, String content,String formId) throws Exception;
+    String submitBusiness(PersonPopedom personPopedom, String type, String destination, String startTime,String endTime,String days, String estimatedTime, String content,String formId,String ids,String draft) throws Exception;
 
     void logic(BusinessOut businessOut) throws Exception;
 

+ 26 - 19
common/src/main/java/com/jpsoft/shinestar/modules/base/service/impl/BusinessOutServiceImpl.java

@@ -405,14 +405,14 @@ public class BusinessOutServiceImpl implements BusinessOutService {
     }
 
     @Override
-    public String submitBusiness(PersonPopedom personPopedom, String type, String destination, String startTime,String endTime,String days, String estimatedTime, String content,String formId) throws Exception {
+    public String submitBusiness(PersonPopedom personPopedom, String type, String destination, String startTime,String endTime,String days, String estimatedTime, String content,String formId,String ids,String draft) throws Exception {
 
 
         BusinessOut businessOut = new BusinessOut();
         businessOut.setId(UUID.randomUUID().toString());
         businessOut.setPersonPopedomId(personPopedom.getId());
         businessOut.setType(type);
-        businessOut.setStatus("0");
+        businessOut.setStatus("-99");
         businessOut.setDestination(destination);
         businessOut.setStartTime(DateUtil.parse(startTime));
       //  businessOut.setEstimatedTime(estimatedTime);
@@ -453,31 +453,38 @@ public class BusinessOutServiceImpl implements BusinessOutService {
             }
         }
 
+        if(StringUtils.isNotEmpty(ids)){
+            update(businessOut);
+        }else {
+            insert(businessOut);
+        }
 
+        if (draft == "1") {
+            String procinstId = procinstService.addProcinst(businessOut.getId(), null, "出差", formId, personPopedom, null);
 
-        String procinstId = procinstService.addProcinst(businessOut.getId(),null,"出差",formId,personPopedom,null);
-
-        businessOut.setProcinstId(procinstId);
+            businessOut.setProcinstId(procinstId);
 
-        insert(businessOut);
+            insert(businessOut);
 
+            businessOut.setStatus("0");
 
-        ProcinstActivity procinstActivity = procinstActivityService.findByActivityIndexAndProcinstId(1, procinstId);
+            ProcinstActivity procinstActivity = procinstActivityService.findByActivityIndexAndProcinstId(1, procinstId);
 
-        if (procinstActivity != null) {
-            List<ProcinstActUser> procinstActUserList = procinstActUserService.findByProcinstActivityIdActionType(procinstActivity.getId(), "0", "1");
-            if (procinstActUserList.size() > 0) {
+            if (procinstActivity != null) {
+                List<ProcinstActUser> procinstActUserList = procinstActUserService.findByProcinstActivityIdActionType(procinstActivity.getId(), "0", "1");
+                if (procinstActUserList.size() > 0) {
 
-                new Thread(() -> {
-                    for (ProcinstActUser procinstActUser : procinstActUserList) {
-                        PersonInfo personInfo = personInfoService.get(Long.parseLong(procinstActUser.getUserId()));
+                    new Thread(() -> {
+                        for (ProcinstActUser procinstActUser : procinstActUserList) {
+                            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=" + businessOut.getId() + "&procinstActUserId=" + procinstActUser.getId() + "&formId=" + formId+"&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
-                    }
-                }).start();
+                            //提交人
+                            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=" + businessOut.getId() + "&procinstActUserId=" + procinstActUser.getId() + "&formId=" + formId + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
+                        }
+                    }).start();
+                }
             }
         }
         return businessOut.getId();

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

@@ -563,14 +563,8 @@ public class RequestForLeaveInfoServiceImpl implements RequestForLeaveInfoServic
 			requestForLeaveInfo.setPersonId(personPopedom.getPersonId());
 			requestForLeaveInfo.setPersonPopedomId(personPopedom.getId());
 			requestForLeaveInfo.setCreateTime(new Date());
+			requestForLeaveInfo.setStatus(-99);
 
-			if (draft == "1") {
-				requestForLeaveInfo.setStatus(0);
-
-			}else{
-				requestForLeaveInfo.setStatus(-99);
-
-			}
 			requestForLeaveInfo.setStartTimeQuantum(startTimeQuantum);
 			requestForLeaveInfo.setEndTimeQuantum(endTimeQuantum);
 			requestForLeaveInfo.setDays(days);
@@ -588,6 +582,7 @@ public class RequestForLeaveInfoServiceImpl implements RequestForLeaveInfoServic
 
 
 			requestForLeaveInfo.setProcinstId(procinstId);
+			requestForLeaveInfo.setStatus(0);
 			update(requestForLeaveInfo);
 
 
@@ -597,6 +592,7 @@ public class RequestForLeaveInfoServiceImpl implements RequestForLeaveInfoServic
 
 
 					if (procinstActivity != null) {
+
 						List<ProcinstActUser> procinstActUserList = procinstActUserService.findByProcinstActivityIdActionType(procinstActivity.getId(), "0", "1");
 						if (procinstActUserList.size() > 0) {
 

+ 4 - 3
web/src/main/java/com/jpsoft/shinestar/modules/mobile/controller/BusinessOutApiController.java

@@ -71,9 +71,10 @@ public class BusinessOutApiController {
             @ApiImplicitParam(name = "days", value = "天数", required = true, paramType = "form"),
             @ApiImplicitParam(name = "estimatedTime", value = "预估时间", required = true, paramType = "form"),
             @ApiImplicitParam(name = "content", value = "事由", required = true, paramType = "form"),
-            @ApiImplicitParam(name = "formId", value = "页面路径", required = true, paramType = "form")
+            @ApiImplicitParam(name = "formId", value = "页面路径", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "draft", value = "状态(0:草稿,1:提交)", required = true, paramType = "form")
     })
-    public MessageResult<Map> submitBusiness(String type, String destination, String startTime, String endTime,String days,String estimatedTime, String content,String formId,@RequestAttribute String subject, String token) {
+    public MessageResult<Map> submitBusiness(String ids,String draft,String type, String destination, String startTime, String endTime,String days,String estimatedTime, String content,String formId,@RequestAttribute String subject, String token) {
         MessageResult<Map> msgResult = new MessageResult<>();
 
         try {
@@ -96,7 +97,7 @@ public class BusinessOutApiController {
                 throw new Exception("休假状态无法出差");
             }
 
-            String id = businessOutService.submitBusiness(personPopedom,type,destination,startTime,endTime,days,estimatedTime,content,formId);
+            String id = businessOutService.submitBusiness(personPopedom,type,destination,startTime,endTime,days,estimatedTime,content,formId,draft,ids);
 
 
             Map<String, Object> map = new HashMap<>();