|
@@ -14,6 +14,10 @@ import com.jpsoft.shinestar.modules.workflow.entity.*;
|
|
|
import com.jpsoft.shinestar.modules.workflow.service.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.expression.EvaluationContext;
|
|
|
+import org.springframework.expression.ExpressionParser;
|
|
|
+import org.springframework.expression.spel.standard.SpelExpressionParser;
|
|
|
+import org.springframework.expression.spel.support.StandardEvaluationContext;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.jpsoft.shinestar.modules.workflow.dao.ProcessSetDAO;
|
|
@@ -96,15 +100,41 @@ public class ProcessSetServiceImpl implements ProcessSetService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ExaminePersonDTO getExaminePerson(String procinstId, String processTemplateId, PersonPopedom personPopedom, Integer activityOrder) throws Exception {
|
|
|
+ public ExaminePersonDTO getExaminePerson(String procinstId, String processTemplateId, PersonPopedom personPopedom, Integer activityOrder,String days) throws Exception {
|
|
|
|
|
|
|
|
|
ExaminePersonDTO examinePersonDTO = new ExaminePersonDTO();
|
|
|
- ProcessActivity processActivity = processActivityService.findByActivityOrderProcessTemplateId(personPopedom.getPersonRoleId(), activityOrder, processTemplateId);
|
|
|
- if (processActivity == null) {
|
|
|
+ List<ProcessActivity> processActivityList = processActivityService.findByActivityOrderProcessTemplateId(personPopedom.getPersonRoleId(), activityOrder, processTemplateId);
|
|
|
+ if (processActivityList.size() == 0) {
|
|
|
throw new Exception("模板没有相应步骤配置");
|
|
|
}
|
|
|
|
|
|
+ ProcessActivity processActivity = null;
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(days)){
|
|
|
+ processActivity = processActivityList.get(0);
|
|
|
+ }else {
|
|
|
+ for (ProcessActivity processActivity1 : processActivityList){
|
|
|
+ if (StringUtils.isNotBlank(processActivity1.getCondition())){
|
|
|
+ ExpressionParser parser = new SpelExpressionParser();
|
|
|
+ Double day = Double.parseDouble(days);
|
|
|
+ EvaluationContext ctx = new StandardEvaluationContext();
|
|
|
+ ctx.setVariable("day", day);
|
|
|
+
|
|
|
+ //#day <7 && #day>2
|
|
|
+ Boolean value = (Boolean) parser.parseExpression(processActivity1.getCondition()).getValue(ctx);
|
|
|
+ if (value){
|
|
|
+ processActivity = processActivity1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (processActivity ==null){
|
|
|
+ throw new Exception("模板相应步骤配置错误");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
String name = "";
|
|
|
String personIds = "";
|
|
@@ -177,54 +207,7 @@ public class ProcessSetServiceImpl implements ProcessSetService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // }
|
|
|
-
|
|
|
- /*else {
|
|
|
- if (StringUtils.isNotBlank(procinstId)) {
|
|
|
- Map<String, Object> searchParams = new HashMap<>();
|
|
|
- searchParams.put("procinstId", procinstId);
|
|
|
- searchParams.put("activityOrder", activityOrder);
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("a.create_time", "desc"));
|
|
|
- Page<ProcinstActUser> page = procinstActUserService.pageSearch(searchParams, 1, 1, false, sortList);
|
|
|
- List<ProcinstActUser> procinstActUserList = page.getResult();
|
|
|
- if (procinstActUserList.size() == 0) {
|
|
|
- throw new Exception("审核第" + activityOrder + "步无对应直属领导审核人");
|
|
|
- }
|
|
|
- ProcinstActUser procinstActUser = procinstActUserList.get(0);
|
|
|
- PersonInfo personInfo = personInfoService.get(Long.parseLong(procinstActUser.getUserId()));
|
|
|
- PersonRoleInfo personRoleInfo = personRoleInfoService.get(personPopedom.getPersonRoleId());
|
|
|
- if (StringUtils.isBlank(personRoleInfo.getParentId())) {
|
|
|
- throw new Exception("审核第" + activityOrder + "步无对应直属领导审核人");
|
|
|
- }
|
|
|
- //直属上级角色
|
|
|
- PersonRoleInfo personRoleInfo1 = personRoleInfoService.get(personRoleInfo.getParentId());
|
|
|
- if (personRoleInfo1 != null) {
|
|
|
- List<String> roleIdsList = new ArrayList<>();
|
|
|
- roleIdsList.add(personRoleInfo1.getId());
|
|
|
- List<PersonPopedom> personPopedomList = personPopedomService.findByCompanyIdAndRoleIdList(personPopedom.getCompanyId(), roleIdsList);
|
|
|
- if (personPopedomList.size() == 0) {
|
|
|
- throw new Exception("审核第" + activityOrder + "步无对应直属领导审核人");
|
|
|
- }
|
|
|
-
|
|
|
- for (PersonPopedom personPopedom1 : personPopedomList) {
|
|
|
- PersonInfo personInfo1 = personInfoService.get(personPopedom1.getPersonId());
|
|
|
- if (StringUtils.isBlank(name)) {
|
|
|
- name = personInfo1.getName();
|
|
|
- personIds = personInfo1.getId().toString();
|
|
|
- } else {
|
|
|
- name = name + "," + personInfo1.getName();
|
|
|
- personIds = personIds + "," + personInfo1.getId();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- }*/
|
|
|
}
|
|
|
|
|
|
|