|
@@ -8,8 +8,12 @@ import com.zjugis.business.flow.leave.service.LeaveService;
|
|
import com.zjugis.business.flow.leave.service.LeaveTimeService;
|
|
import com.zjugis.business.flow.leave.service.LeaveTimeService;
|
|
import com.zjugis.framework.workflow.exception.BusinessException;
|
|
import com.zjugis.framework.workflow.exception.BusinessException;
|
|
import com.zjugis.framework.workflow.model.BaseController;
|
|
import com.zjugis.framework.workflow.model.BaseController;
|
|
|
|
+import com.zjugis.framework.workflow.rpc.remote.WorkflowClient;
|
|
import com.zjugis.framework.workflow.spring.resovler.ParamModel;
|
|
import com.zjugis.framework.workflow.spring.resovler.ParamModel;
|
|
import com.zjugis.module.adm.api.attendance.AttendanceSheetApi;
|
|
import com.zjugis.module.adm.api.attendance.AttendanceSheetApi;
|
|
|
|
+import com.zjugis.module.system.api.permission.RoleApi;
|
|
|
|
+import com.zjugis.module.system.api.permission.dto.RoleRespDto;
|
|
|
|
+import com.zjugis.module.system.api.user.AdminUserApi;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -19,10 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+
|
|
|
|
+import static com.zjugis.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Author 陈俊
|
|
* @Author 陈俊
|
|
@@ -41,6 +44,10 @@ public class LeaveEvent extends BaseController {
|
|
private LeaveTimeService leaveTimeService;
|
|
private LeaveTimeService leaveTimeService;
|
|
@Resource
|
|
@Resource
|
|
private AttendanceSheetApi attendanceSheetApi;
|
|
private AttendanceSheetApi attendanceSheetApi;
|
|
|
|
+ @Resource
|
|
|
|
+ private WorkflowClient workflowClient;
|
|
|
|
+ @Resource
|
|
|
|
+ private RoleApi roleApi;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 设置流程描述
|
|
* 设置流程描述
|
|
@@ -56,17 +63,19 @@ public class LeaveEvent extends BaseController {
|
|
String flowInstanceId = activityInstance.get("flowInstanceId").toString();
|
|
String flowInstanceId = activityInstance.get("flowInstanceId").toString();
|
|
LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
String flowDesc = "";
|
|
String flowDesc = "";
|
|
- if (!Strings.isNullOrEmpty(entity.getDeptName())) {
|
|
|
|
- flowDesc += "/" + entity.getDeptName();
|
|
|
|
- }
|
|
|
|
if (!Strings.isNullOrEmpty(entity.getUserNickname())) {
|
|
if (!Strings.isNullOrEmpty(entity.getUserNickname())) {
|
|
flowDesc += "/" + entity.getUserNickname();
|
|
flowDesc += "/" + entity.getUserNickname();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if (!Strings.isNullOrEmpty(entity.getLeaveHours().toString())) {
|
|
|
|
+ flowDesc += "/" + entity.getLeaveHours().toString();
|
|
|
|
+ }
|
|
|
|
+ if (!Strings.isNullOrEmpty(entity.getLeaveReason())) {
|
|
|
|
+ flowDesc += "/" + entity.getLeaveReason();
|
|
|
|
+ }
|
|
entity.setFlowStatus(1);
|
|
entity.setFlowStatus(1);
|
|
leaveService.updateLeave(LeaveConvert.INSTANCE.convert(entity));
|
|
leaveService.updateLeave(LeaveConvert.INSTANCE.convert(entity));
|
|
flowDesc = flowDesc.length() > 1 ? flowDesc.substring(1) : flowDesc;
|
|
flowDesc = flowDesc.length() > 1 ? flowDesc.substring(1) : flowDesc;
|
|
-// String result = E_FlowUtils.setFlowDesc(flowDesc, flowInstanceId);
|
|
|
|
|
|
+ workflowClient.saveFlowDescribe(flowInstanceId,flowDesc);
|
|
return ok("true");
|
|
return ok("true");
|
|
} else {
|
|
} else {
|
|
throw new BusinessException("执行事件出错,请联系管理员!");
|
|
throw new BusinessException("执行事件出错,请联系管理员!");
|
|
@@ -198,8 +207,23 @@ public class LeaveEvent extends BaseController {
|
|
try {
|
|
try {
|
|
String flowInstanceId = flowInstance.get("id").toString();
|
|
String flowInstanceId = flowInstance.get("id").toString();
|
|
LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
- if(entity != null && entity.getLeaveHours() != null
|
|
|
|
- && entity.getLeaveHours() > (7.5*3)){
|
|
|
|
|
|
+ if (entity != null && entity.getLeaveHours() != null
|
|
|
|
+ && entity.getLeaveHours() > (7.5 * 3)) {
|
|
|
|
+ return "true";
|
|
|
|
+ }
|
|
|
|
+ return "false";
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return error(ex.getMessage(), ErrorCode.DEFAULT);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("/le3")
|
|
|
|
+ public String le3(@ParamModel Map flowInstance, @ParamModel Map flowDirectionInstance, @ParamModel Map previousActivityInstance, @ParamModel Map previousGatewayInstance, @ParamModel Map nextActivityTemplate, @ParamModel Map nextGatewayInstance) {
|
|
|
|
+ try {
|
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
|
+ LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
|
|
+ if (entity != null && entity.getLeaveHours() != null
|
|
|
|
+ && entity.getLeaveHours() <= (7.5 * 3)) {
|
|
return "true";
|
|
return "true";
|
|
}
|
|
}
|
|
return "false";
|
|
return "false";
|
|
@@ -213,8 +237,59 @@ public class LeaveEvent extends BaseController {
|
|
try {
|
|
try {
|
|
String flowInstanceId = flowInstance.get("id").toString();
|
|
String flowInstanceId = flowInstance.get("id").toString();
|
|
LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
- if(entity != null && entity.getLeaveHours() != null
|
|
|
|
- && entity.getLeaveHours() > (7.5*7)){
|
|
|
|
|
|
+ if (entity != null && entity.getLeaveHours() != null
|
|
|
|
+ && entity.getLeaveHours() > (7.5 * 7)) {
|
|
|
|
+ return "true";
|
|
|
|
+ }
|
|
|
|
+ return "false";
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return error(ex.getMessage(), ErrorCode.DEFAULT);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("/le7")
|
|
|
|
+ public String le7(@ParamModel Map flowInstance, @ParamModel Map flowDirectionInstance, @ParamModel Map previousActivityInstance, @ParamModel Map previousGatewayInstance, @ParamModel Map nextActivityTemplate, @ParamModel Map nextGatewayInstance) {
|
|
|
|
+ try {
|
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
|
+ LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
|
|
+ if (entity != null && entity.getLeaveHours() != null
|
|
|
|
+ && entity.getLeaveHours() <= (7.5 * 7)) {
|
|
|
|
+ return "true";
|
|
|
|
+ }
|
|
|
|
+ return "false";
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return error(ex.getMessage(), ErrorCode.DEFAULT);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("/managerGt3")
|
|
|
|
+ public String managerGt3(@ParamModel Map flowInstance, @ParamModel Map flowDirectionInstance, @ParamModel Map previousActivityInstance, @ParamModel Map previousGatewayInstance, @ParamModel Map nextActivityTemplate, @ParamModel Map nextGatewayInstance) {
|
|
|
|
+ try {
|
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
|
+ LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
|
|
+ List<RoleRespDto> roleList = roleApi.getRoleByUser(entity.getUserId()).getCheckedData();
|
|
|
|
+ Set<String> roleName = convertSet(roleList, RoleRespDto::getName);
|
|
|
|
+ Double leaveHours = entity.getLeaveHours();
|
|
|
|
+ if (roleName.contains("测试部门经理") && entity != null && leaveHours != null
|
|
|
|
+ && leaveHours > (7.5 * 3)) {
|
|
|
|
+ return "true";
|
|
|
|
+ }
|
|
|
|
+ return "false";
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return error(ex.getMessage(), ErrorCode.DEFAULT);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("/managerLe3")
|
|
|
|
+ public String managerLe3(@ParamModel Map flowInstance, @ParamModel Map flowDirectionInstance, @ParamModel Map previousActivityInstance, @ParamModel Map previousGatewayInstance, @ParamModel Map nextActivityTemplate, @ParamModel Map nextGatewayInstance) {
|
|
|
|
+ try {
|
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
|
+ LeaveDO entity = leaveService.findByInstanceId(flowInstanceId);
|
|
|
|
+ List<RoleRespDto> roleList = roleApi.getRoleByUser(entity.getUserId()).getCheckedData();
|
|
|
|
+ Set<String> roleName = convertSet(roleList, RoleRespDto::getName);
|
|
|
|
+ Double leaveHours = entity.getLeaveHours();
|
|
|
|
+ if (roleName.contains("测试部门经理") && entity != null && leaveHours != null
|
|
|
|
+ && leaveHours <= (7.5 * 3)) {
|
|
return "true";
|
|
return "true";
|
|
}
|
|
}
|
|
return "false";
|
|
return "false";
|