|
@@ -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());
|