|
@@ -10,6 +10,9 @@ import com.zjugis.framework.workflow.exception.BusinessException;
|
|
|
import com.zjugis.framework.workflow.model.BaseController;
|
|
|
import com.zjugis.framework.workflow.spring.resovler.ParamModel;
|
|
|
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.LoggerFactory;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -19,10 +22,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDate;
|
|
|
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 陈俊
|
|
@@ -41,6 +43,10 @@ public class LeaveEvent extends BaseController {
|
|
|
private LeaveTimeService leaveTimeService;
|
|
|
@Resource
|
|
|
private AttendanceSheetApi attendanceSheetApi;
|
|
|
+ @Resource
|
|
|
+ private AdminUserApi adminUserApi;
|
|
|
+ @Resource
|
|
|
+ private RoleApi roleApi;
|
|
|
|
|
|
/**
|
|
|
* 设置流程描述
|
|
@@ -198,8 +204,23 @@ public class LeaveEvent extends BaseController {
|
|
|
try {
|
|
|
String flowInstanceId = flowInstance.get("id").toString();
|
|
|
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 "false";
|
|
@@ -213,8 +234,59 @@ public class LeaveEvent extends BaseController {
|
|
|
try {
|
|
|
String flowInstanceId = flowInstance.get("id").toString();
|
|
|
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 "false";
|