|
@@ -31,20 +31,25 @@ import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.vo.ComboModel;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.util.DDMsgUtil;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.common.util.HttpUtils;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.common.util.security.EncryptUtil;
|
|
|
import org.jeecg.modules.activiti.entity.*;
|
|
|
+import org.jeecg.modules.activiti.service.IActNodeService;
|
|
|
import org.jeecg.modules.activiti.service.IActReModelService;
|
|
|
import org.jeecg.modules.activiti.service.ITbTableInfoOuterService;
|
|
|
import org.jeecg.modules.activiti.service.ITbTableInfoPracticeService;
|
|
|
import org.jeecg.modules.activiti.service.Impl.ActBusinessServiceImpl;
|
|
|
+import org.jeecg.modules.activiti.service.Impl.ActNodeServiceImpl;
|
|
|
import org.jeecg.modules.activiti.service.Impl.ActZprocessServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.net.URLDecoder;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -85,6 +90,8 @@ public class ActTaskController {
|
|
|
private ITbTableInfoOuterService tbTableInfoOuterService;
|
|
|
@Autowired
|
|
|
private ITbTableInfoPracticeService tbTableInfoPracticeService;
|
|
|
+ @Autowired
|
|
|
+ private IActNodeService actNodeService;
|
|
|
|
|
|
public void show(String userId,String name,String categoryId, Integer priority, HttpServletRequest request,List<Task> taskList){
|
|
|
TaskQuery query = taskService.createTaskQuery().taskCandidateOrAssigned(userId);
|
|
@@ -473,6 +480,8 @@ public class ActTaskController {
|
|
|
List<Task> tasks = taskService.createTaskQuery().processInstanceId(procInstId).list();
|
|
|
|
|
|
ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+
|
|
|
+ Map<String, Object> busiData = actBusinessService.getBaseMapper().getBusiData(actBusiness.getTableId(), actBusiness.getTableName());
|
|
|
|
|
|
if(tasks!=null&&tasks.size()>0){
|
|
|
|
|
@@ -502,6 +511,7 @@ public class ActTaskController {
|
|
|
|
|
|
List<String> list = actBusinessService.selectIRunIdentity(t.getId(), "candidate");
|
|
|
if(list==null||list.size()==0) {
|
|
|
+ String ddUserIds = "";
|
|
|
|
|
|
for (LoginUser user : users) {
|
|
|
taskService.addCandidateUser(t.getId(), user.getId());
|
|
@@ -513,6 +523,26 @@ public class ActTaskController {
|
|
|
|
|
|
}
|
|
|
taskService.setPriority(t.getId(), task.getPriority());
|
|
|
+
|
|
|
+
|
|
|
+ if (oConvertUtils.isNotEmpty(ddUserIds)){
|
|
|
+ String title = actBusiness.getTitle()+"需要您审批";
|
|
|
+ String content = "";
|
|
|
+
|
|
|
+ if ("incident_ticket".equalsIgnoreCase(actBusiness.getTableName())){
|
|
|
+ content= "填报人:"+oConvertUtils.getString(busiData.get("informant"))+
|
|
|
+ ";责任部门:"+oConvertUtils.getString(busiData.get("department_main"))+
|
|
|
+ ";主题:"+oConvertUtils.getString(busiData.get("accident_theme"));
|
|
|
+ }else if ("preparation_material_v1".equalsIgnoreCase(actBusiness.getTableName())) {
|
|
|
+ content = "计划单号:"+oConvertUtils.getString(busiData.get("informant")) +
|
|
|
+ ";供应商:"+oConvertUtils.getString(busiData.get("cvenabbname")) +
|
|
|
+ ";申请人:"+oConvertUtils.getString(busiData.get("main_create_by")) +
|
|
|
+ ";申请数量:"+oConvertUtils.getString(busiData.get("imquantity"));
|
|
|
+ }
|
|
|
+ if (oConvertUtils.isNotEmpty(content)) {
|
|
|
+ DDMsgUtil.sendOaMessage(ddUserIds, title, content, task.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
@@ -532,6 +562,38 @@ public class ActTaskController {
|
|
|
|
|
|
taskService.setPriority(t.getId(), priority);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ List<LoginUser> allUserList = actNodeService.queryAllUser();
|
|
|
+ List<String> assigneeUserIdList = Arrays.asList(assignees.split(","));
|
|
|
+ StringBuilder ddUserIds = new StringBuilder();
|
|
|
+ allUserList.forEach(u->{
|
|
|
+ if (oConvertUtils.isNotEmpty(u.getDingUser())){
|
|
|
+ if (assigneeUserIdList.stream().filter(e->e.equals(u.getUsername())).count()>0){
|
|
|
+ ddUserIds.append(u.getDingUser()+",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ if (ddUserIds.length()>0){
|
|
|
+ String title = actBusiness.getTitle()+"需要您审批";
|
|
|
+ String content = "";
|
|
|
+
|
|
|
+ if ("incident_ticket".equalsIgnoreCase(actBusiness.getTableName())){
|
|
|
+ content= "填报人:"+oConvertUtils.getString(busiData.get("informant"))+
|
|
|
+ ";责任部门:"+oConvertUtils.getString(busiData.get("department_main"))+
|
|
|
+ ";主题:"+oConvertUtils.getString(busiData.get("accident_theme"));
|
|
|
+ }else if ("preparation_material_v1".equalsIgnoreCase(actBusiness.getTableName())) {
|
|
|
+ content = "计划单号:"+oConvertUtils.getString(busiData.get("informant")) +
|
|
|
+ ";供应商:"+oConvertUtils.getString(busiData.get("cvenabbname")) +
|
|
|
+ ";申请人:"+oConvertUtils.getString(busiData.get("main_create_by")) +
|
|
|
+ ";申请数量:"+oConvertUtils.getString(busiData.get("imquantity"));
|
|
|
+ }
|
|
|
+ if (oConvertUtils.isNotEmpty(content)) {
|
|
|
+ DDMsgUtil.sendOaMessage(ddUserIds.toString(), title, content, task.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -904,4 +966,87 @@ public class ActTaskController {
|
|
|
result.put("data", data);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping(value = "/getSelfTaskById" )
|
|
|
+ public Result<Object> getSelfTaskById(String key, HttpServletRequest request){
|
|
|
+ try {
|
|
|
+ String decryptKey = EncryptUtil.desDecrypt(key);
|
|
|
+ String[] arr = decryptKey.split("_");
|
|
|
+ String taskId = arr[1];
|
|
|
+
|
|
|
+ List<TaskVo> list = new ArrayList<>();
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ String userId = sysUser.getUsername();
|
|
|
+
|
|
|
+ List<Task> taskList = new ArrayList<>();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("username", sysUser.getUsername());
|
|
|
+ map.put("userId", sysUser.getId());
|
|
|
+
|
|
|
+ map.put("pkOrg", sysUser.getOrgCode());
|
|
|
+ taskList = iActReModelService.getListTask(map).stream().filter(e -> e.getId().equals(taskId)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (Task e : taskList) {
|
|
|
+ TaskVo tv = new TaskVo(e);
|
|
|
+
|
|
|
+ if (StrUtil.isNotBlank(tv.getOwner())) {
|
|
|
+ String realname = sysBaseAPI.getUserByName(tv.getOwner()).getRealname();
|
|
|
+ tv.setOwner(realname);
|
|
|
+ }
|
|
|
+ List<IdentityLink> identityLinks = runtimeService.getIdentityLinksForProcessInstance(tv.getProcInstId());
|
|
|
+ for (IdentityLink ik : identityLinks) {
|
|
|
+
|
|
|
+ if ("starter".equals(ik.getType()) && StrUtil.isNotBlank(ik.getUserId())) {
|
|
|
+ tv.setApplyer(sysBaseAPI.getUserByName(ik.getUserId()).getRealname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ActZprocess actProcess = actZprocessService.getById(tv.getProcDefId());
|
|
|
+ if (actProcess != null) {
|
|
|
+ tv.setProcessName(actProcess.getName());
|
|
|
+ tv.setRouteName(actProcess.getRouteName());
|
|
|
+ }
|
|
|
+
|
|
|
+ ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(tv.getProcInstId()).singleResult();
|
|
|
+ tv.setBusinessKey(pi.getBusinessKey());
|
|
|
+ ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+ if (actBusiness != null) {
|
|
|
+ tv.setTableId(actBusiness.getTableId());
|
|
|
+ tv.setTableName(actBusiness.getTableName());
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ TbTableInfoPractice tbTableInfoPractice = tbTableInfoPracticeService.getById(actBusiness.getTableId());
|
|
|
+ if (tbTableInfoPractice != null && oConvertUtils.isNotEmpty(tbTableInfoPractice.getExtraInfo())) {
|
|
|
+ tv.setDescription(tbTableInfoPractice.getExtraInfo());
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+
|
|
|
+ QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
|
|
|
+ practiceQueryWrapper.eq("business_table_id", actBusiness.getTableId());
|
|
|
+ practiceQueryWrapper.and(i -> i.eq("is_initial", "1").or().eq("is_initial", null).or().eq("is_initial", "").or().isNull("is_initial"));
|
|
|
+ tbTableInfoPractice = tbTableInfoPracticeService.getOne(practiceQueryWrapper);
|
|
|
+ if (tbTableInfoPractice != null && oConvertUtils.isNotEmpty(tbTableInfoPractice.getExtraInfo())) {
|
|
|
+ tv.setDescription(tbTableInfoPractice.getExtraInfo());
|
|
|
+ }
|
|
|
+ } catch (Exception ee) {
|
|
|
+ System.out.println("业务信息获取错误" + ee.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (tv.getDescription() == null) {
|
|
|
+ tv.setDescription("");
|
|
|
+ }
|
|
|
+
|
|
|
+ list.add(tv);
|
|
|
+ }
|
|
|
+ return Result.ok(list);
|
|
|
+ }catch (Exception ex){
|
|
|
+ ex.printStackTrace();
|
|
|
+ return Result.error(ex.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|