ljy121 1 rok temu
rodzic
commit
80908ab843

+ 35 - 29
zjugis-business/src/main/java/com/zjugis/business/flow/common/event/CommonEvent.java

@@ -6,7 +6,6 @@ import com.zjugis.framework.workflow.exception.BusinessException;
 import com.zjugis.framework.workflow.model.BaseController;
 import com.zjugis.framework.workflow.model.IActivityInsParticiPantDto;
 import com.zjugis.framework.workflow.model.IFlowInstance;
-import com.zjugis.framework.workflow.model.IFlowInstanceReq;
 import com.zjugis.framework.workflow.rpc.remote.WorkflowClient;
 import com.zjugis.framework.workflow.spring.resovler.ParamModel;
 import com.zjugis.module.infra.api.ding.DingApi;
@@ -16,6 +15,7 @@ import com.zjugis.module.infra.api.ding.enums.DingMsg;
 import com.zjugis.module.system.api.user.AdminUserApi;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -43,6 +43,10 @@ public class CommonEvent extends BaseController {
     @Autowired
     DingApi dingApi;
 
+    @Value("${serviceUrl.z_workflow}")
+    private String workflowUrl;
+
+
     @PostMapping("/send-ding-message")
     public String sendDingMessage(@ParamModel Map flowInstance, @ParamModel Map activityInstance,String currentUserId) {
         try {
@@ -68,15 +72,22 @@ public class CommonEvent extends BaseController {
                     index ++;
                 }
                 for (int i = 0; i < parts.size(); i++) {
-                    IFlowInstanceReq iFlowInstanceReq = new IFlowInstanceReq();
-                    iFlowInstanceReq.setFlowInstanceId(flowInstanceId);
-                    iFlowInstanceReq.setMobile(true);
-                    iFlowInstanceReq.setUserId(currentUserId);
-                    iFlowInstanceReq.setParticipantId(parts.get(i).getId());
-                    iFlowInstanceReq.setUserId(parts.get(i).getUserId());
-                    iFlowInstanceReq.setActivityInsId(activityInstanceId);
-                    CommonResult<String> flowUrlRes = workflowClient.getFlowUrl(iFlowInstanceReq);
-                    String mobileUrl = flowUrlRes.getCheckedData();
+                    StringBuilder url = new StringBuilder();
+                    url.append(workflowUrl)
+                            .append("/IFlowInstance/redirectFlowPage")
+                            .append("?")
+                            .append("flowInstanceId=").append(flowInstanceId)
+                            .append("&")
+                            .append("activityInsId=").append(activityInstanceId)
+                            .append("&")
+                            .append("userId=").append(parts.get(i).getUserId())
+                            .append("&")
+                            .append("iMobile=").append(1)
+                            .append("&")
+                            .append("view=").append(0)
+                            .append("&")
+                            .append("participantId=").append(parts.get(i).getId());
+
                     IActivityInsParticiPantDto item = parts.get(i);
                     String content = "";
                     if(describtion == null){
@@ -84,25 +95,20 @@ public class CommonEvent extends BaseController {
                     } else {
                         content += describtion.toString();
                     }
-                    if(StringUtils.isNotBlank(mobileUrl)){
-                        OA oa = new OA();
-                        oa.setMessageUrl(mobileUrl+"&_top=1");
-                        OA.Head head = new OA.Head();
-                        head.setBgcolor("43CCF9");
-                        head.setText("浙江万维OA");
-                        oa.setHead(head);
-                        OA.Body body = new OA.Body();
-                        body.setTitle(flowName);
-                        body.setContent(content);
-                        oa.setBody(body);
-                        DingMessageDto message = new DingMessageDto(item.getUserId());
-                        message.setMsgType(DingMsg.OA);
-                        message.setOa(oa);
-                        dingApi.sendMessage(message);
-                    } else {
-                        DingMessageDto message = new DingMessageDto(item.getUserId(),content);
-                        dingApi.sendMessage(message);
-                    }
+                    OA oa = new OA();
+                    oa.setMessageUrl(url.toString());
+                    OA.Head head = new OA.Head();
+                    head.setBgcolor("43CCF9");
+                    head.setText("浙江万维OA");
+                    oa.setHead(head);
+                    OA.Body body = new OA.Body();
+                    body.setTitle(flowName);
+                    body.setContent(content);
+                    oa.setBody(body);
+                    DingMessageDto message = new DingMessageDto(item.getUserId());
+                    message.setMsgType(DingMsg.OA);
+                    message.setOa(oa);
+                    dingApi.sendMessage(message);
                 }
             }
             return ok("true");

+ 6 - 2
zjugis-workflow/src/main/java/com/zjugis/z_workflow/controller/IFlowInstanceController.java

@@ -185,9 +185,13 @@ public class IFlowInstanceController extends BaseController {
 	 */
 	@ResponseBody
 	@RequestMapping
-	public void redirectFlowPage(String flowInstanceId,String activityInsId,String userId,Integer iMobile) throws IOException {
+	public void redirectFlowPage(String flowInstanceId,String activityInsId,String userId,Integer iMobile,Integer view,String participantId) throws IOException {
 		boolean isMobile = !Objects.isNull(iMobile) && iMobile.equals(1) ;
-		String redirectURL = iActivityInstanceService.getHandlerUrl(activityInsId,flowInstanceId,null,userId,isMobile,true,null);
+        boolean isView = Objects.isNull(view) || view.equals(1) ;
+		String redirectURL = iActivityInstanceService.getHandlerUrl(activityInsId,flowInstanceId,participantId,userId,isMobile,isView,null);
+        if(!isView && isMobile){
+            redirectURL += "&_top=1";
+        }
 		response.sendRedirect(redirectURL);
 	}