diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/controller/BusProcessModelHisController.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/controller/BusProcessModelHisController.java index 5da06d95..cf2a4ce8 100644 --- a/src/main/java/com/ydw/bat/wkflow/business_main/datas/controller/BusProcessModelHisController.java +++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/controller/BusProcessModelHisController.java @@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URL; import java.net.URLConnection; +import java.util.Arrays; import java.util.List; import java.util.Scanner; @@ -51,11 +52,12 @@ public class BusProcessModelHisController { @ApiOperation(value = "|onlyOffice接收文件") @PostMapping("/recieveFile") - public void recieveFile(HttpServletRequest request, HttpServletResponse response, String fileNm, String standNo, String fileId){ + public void recieveFile(HttpServletRequest request, HttpServletResponse response, String fileNm, String standNo, String fileId,String standName){ logger.info("**********进入onlyoffice接收文档接口************"); logger.info("**********fileNm************"+fileNm+"======="); logger.info("**********standNo************"+standNo+"======="); logger.info("**********fileId************"+fileId+"======="); + logger.info("**********standName************"+standName+"======="); try { PrintWriter writer = response.getWriter(); String body = ""; @@ -86,10 +88,20 @@ public class BusProcessModelHisController { try { logger.info("**********onlyoffice接收文档接口获得downloadUri************" + downloadUri); if (StringUtils.isNotEmpty(downloadUri)) { + String fileName = standName; + if(StringUtils.isNotBlank(fileNm)){ + String[] split = fileNm.split("\\."); + List asList = Arrays.asList(split); + if(asList.size()>1){ + fileName = standName+"."+split[1]; + logger.info("**********fileName************"+fileName+"======="); + } + } StringBuilder builder=new StringBuilder(); builder.append(standEditFilePath); builder.append(standNo).append("/"); - builder.append(fileNm); + builder.append(fileName); +// builder.append(fileNm); String saveFileUrl = builder.toString(); File file = new File(saveFileUrl); downloadNetFile(downloadUri, file); @@ -119,12 +131,13 @@ public class BusProcessModelHisController { @ApiOperation(value = "|onlyOffice接收文件") @PostMapping("/recieveFileBefore") - public void recieveFileBefore(HttpServletRequest request, HttpServletResponse response, String fileNm, String standNo, String pid, String taskId){ + public void recieveFileBefore(HttpServletRequest request, HttpServletResponse response, String fileNm, String standNo, String pid, String taskId ,String standName){ logger.info("**********进入onlyoffice接收文档接口************"); logger.info("**********fileNm************"+fileNm+"======="); logger.info("**********standNo************"+standNo+"======="); logger.info("**********fileId************"+pid+"======="); - logger.info("**********fileId************"+taskId+"======="); + logger.info("**********taskId************"+taskId+"======="); + logger.info("**********standName************"+standName+"======="); try { PrintWriter writer = response.getWriter(); String body = ""; @@ -155,10 +168,19 @@ public class BusProcessModelHisController { try { logger.info("**********onlyoffice接收文档接口获得downloadUri************" + downloadUri); if (StringUtils.isNotEmpty(downloadUri)) { + String fileName = standName; + if(StringUtils.isNotBlank(fileNm)){ + String[] split = fileNm.split("\\."); + List asList = Arrays.asList(split); + if(asList.size()>1){ + fileName = standName+"."+split[1]; + logger.info("**********fileName************"+fileName+"======="); + } + } StringBuilder builder=new StringBuilder(); builder.append(standEditFilePath); builder.append(standNo).append("/"); - builder.append(fileNm); + builder.append(fileName); String saveFileUrl = builder.toString(); File file = new File(saveFileUrl); downloadNetFile(downloadUri, file); diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/impl/WebServiceOAServiceImpl.java b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/impl/WebServiceOAServiceImpl.java index 8d7f011b..8ebf2e2f 100644 --- a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/impl/WebServiceOAServiceImpl.java +++ b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/impl/WebServiceOAServiceImpl.java @@ -89,43 +89,43 @@ public class WebServiceOAServiceImpl implements WebServiceOAService { CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class); log.info("--------------------------ESP 发送单个删除OA待办----------------------------"); - if(StringUtils.isNotBlank(todoId) && StringUtils.isNotBlank(assignee)){ - - QueryWrapper wrapper = new QueryWrapper(); - wrapper.eq("TODO_ID",todoId); - wrapper.eq("MSG_TYPE","0"); - List list = sendTodoLogMapper.selectList(wrapper); - if(!list.isEmpty()){ - net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(list.get(0).getMesg()); - net.sf.json.JSONObject jsonObjectFilter = net.sf.json.JSONObject.fromObject(list.get(0).getMesg()); - jsonObjectFilter = jsonObjectFilter.discard("PId"); - jsonObjectFilter.remove("createTime"); - jsonObjectFilter.remove("updateTime"); - jsonObjectFilter.put("pid",fromObject.getString("PId")); - BusProcessNew object = JSON.parseObject(jsonObjectFilter.toString(),BusProcessNew.class); - - List notifyTodoSendContexts = new ArrayList<>(); - NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); - notifyTodoSendContext.setAppName("SPRS"); - notifyTodoSendContext.setModelId(todoId); - notifyTodoSendContext.setModelName(object.getTaskInfo()); - notifyTodoSendContext.setType("1"); - notifyTodoSendContext.setOptType("2"); - Map map = new HashMap<>(); - ResponseMessage byId = lawsUserInfoService.getById(assignee); - map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); - JSONObject jsonLoginName = new JSONObject(map); - notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); - notifyTodoSendContext.setUserId(assignee); - notifyTodoSendContexts.add(notifyTodoSendContext); - Map objectMap = new TreeMap<>(); - objectMap.put("todoId",todoId); - objectMap.put("list",notifyTodoSendContexts); - net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(objectMap); - log.info("=================发送单个删除OA待办:"+jsonObject.toString()); - oaService.setTodoDeleteMq(jsonObject.toString()); - } - } +// if(StringUtils.isNotBlank(todoId) && StringUtils.isNotBlank(assignee)){ +// +// QueryWrapper wrapper = new QueryWrapper(); +// wrapper.eq("TODO_ID",todoId); +// wrapper.eq("MSG_TYPE","0"); +// List list = sendTodoLogMapper.selectList(wrapper); +// if(!list.isEmpty()){ +// net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(list.get(0).getMesg()); +// net.sf.json.JSONObject jsonObjectFilter = net.sf.json.JSONObject.fromObject(list.get(0).getMesg()); +// jsonObjectFilter = jsonObjectFilter.discard("PId"); +// jsonObjectFilter.remove("createTime"); +// jsonObjectFilter.remove("updateTime"); +// jsonObjectFilter.put("pid",fromObject.getString("PId")); +// BusProcessNew object = JSON.parseObject(jsonObjectFilter.toString(),BusProcessNew.class); +// +// List notifyTodoSendContexts = new ArrayList<>(); +// NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); +// notifyTodoSendContext.setAppName("SPRS"); +// notifyTodoSendContext.setModelId(todoId); +// notifyTodoSendContext.setModelName(object.getTaskInfo()); +// notifyTodoSendContext.setType("1"); +// notifyTodoSendContext.setOptType("2"); +// Map map = new HashMap<>(); +// ResponseMessage byId = lawsUserInfoService.getById(assignee); +// map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); +// JSONObject jsonLoginName = new JSONObject(map); +// notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); +// notifyTodoSendContext.setUserId(assignee); +// notifyTodoSendContexts.add(notifyTodoSendContext); +// Map objectMap = new TreeMap<>(); +// objectMap.put("todoId",todoId); +// objectMap.put("list",notifyTodoSendContexts); +// net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(objectMap); +// log.info("=================发送单个删除OA待办:"+jsonObject.toString()); +// oaService.setTodoDeleteMq(jsonObject.toString()); +// } +// } } /** @@ -137,47 +137,47 @@ public class WebServiceOAServiceImpl implements WebServiceOAService { CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class); log.info("--------------------------ESP 发送删除待办任务 及 再次发送待办----------------------------"); - if(busProcessNew != null && StringUtils.isNotBlank(busProcessNew.getId())){ - - QueryWrapper wrapper = new QueryWrapper(); - wrapper.eq("TODO_ID",busProcessNew.getId()); - wrapper.eq("MSG_TYPE","0"); - List list = sendTodoLogMapper.selectList(wrapper); - if(!list.isEmpty()){ - net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(list.get(0).getMesg()); - net.sf.json.JSONObject jsonObjectFilter = net.sf.json.JSONObject.fromObject(list.get(0).getMesg()); - jsonObjectFilter = jsonObjectFilter.discard("PId"); - jsonObjectFilter.remove("createTime"); - jsonObjectFilter.remove("updateTime"); - jsonObjectFilter.put("pid",fromObject.getString("PId")); - BusProcessNew object = JSON.parseObject(jsonObjectFilter.toString(),BusProcessNew.class); - - List notifyTodoSendContexts = new ArrayList<>(); - NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); - notifyTodoSendContext.setAppName("SPRS"); - notifyTodoSendContext.setModelId(busProcessNew.getId()); - notifyTodoSendContext.setModelName(object.getTaskInfo()); - notifyTodoSendContext.setType("1"); - notifyTodoSendContext.setOptType("2"); - Map map = new HashMap<>(); - ResponseMessage byId = lawsUserInfoService.getById(busProcessNew.getUserId()); - map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); - JSONObject jsonLoginName = new JSONObject(map); - notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); - notifyTodoSendContext.setUserId(busProcessNew.getUserId()); - notifyTodoSendContexts.add(notifyTodoSendContext); - Map objectMap = new TreeMap<>(); - objectMap.put("todoId",busProcessNew.getId()); - objectMap.put("list",notifyTodoSendContexts); - net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(objectMap); - oaService.setTodoDeleteMq(jsonObject.toString()); - log.info("=================ESP 发送删除待办任务 及 再次发送待办:"+jsonObject.toString()); - - // 重新发送OA待办 - object.setUserId(assignee); - oaService.sendTodoMq(object); - } - } +// if(busProcessNew != null && StringUtils.isNotBlank(busProcessNew.getId())){ +// +// QueryWrapper wrapper = new QueryWrapper(); +// wrapper.eq("TODO_ID",busProcessNew.getId()); +// wrapper.eq("MSG_TYPE","0"); +// List list = sendTodoLogMapper.selectList(wrapper); +// if(!list.isEmpty()){ +// net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(list.get(0).getMesg()); +// net.sf.json.JSONObject jsonObjectFilter = net.sf.json.JSONObject.fromObject(list.get(0).getMesg()); +// jsonObjectFilter = jsonObjectFilter.discard("PId"); +// jsonObjectFilter.remove("createTime"); +// jsonObjectFilter.remove("updateTime"); +// jsonObjectFilter.put("pid",fromObject.getString("PId")); +// BusProcessNew object = JSON.parseObject(jsonObjectFilter.toString(),BusProcessNew.class); +// +// List notifyTodoSendContexts = new ArrayList<>(); +// NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); +// notifyTodoSendContext.setAppName("SPRS"); +// notifyTodoSendContext.setModelId(busProcessNew.getId()); +// notifyTodoSendContext.setModelName(object.getTaskInfo()); +// notifyTodoSendContext.setType("1"); +// notifyTodoSendContext.setOptType("2"); +// Map map = new HashMap<>(); +// ResponseMessage byId = lawsUserInfoService.getById(busProcessNew.getUserId()); +// map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); +// JSONObject jsonLoginName = new JSONObject(map); +// notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); +// notifyTodoSendContext.setUserId(busProcessNew.getUserId()); +// notifyTodoSendContexts.add(notifyTodoSendContext); +// Map objectMap = new TreeMap<>(); +// objectMap.put("todoId",busProcessNew.getId()); +// objectMap.put("list",notifyTodoSendContexts); +// net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(objectMap); +// oaService.setTodoDeleteMq(jsonObject.toString()); +// log.info("=================ESP 发送删除待办任务 及 再次发送待办:"+jsonObject.toString()); +// +// // 重新发送OA待办 +// object.setUserId(assignee); +// oaService.sendTodoMq(object); +// } +// } } /** @@ -190,234 +190,234 @@ public class WebServiceOAServiceImpl implements WebServiceOAService { CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class); log.info("--------------------------ESP 批量发送删除待办任务----------------------------"); - QueryWrapper queryWrapper1 = new QueryWrapper(); - queryWrapper1.eq("P_ID",pId); - List list = iBusProcessNewService.list(queryWrapper1); - if(!list.isEmpty()){ - List notifyTodoSendContexts = new ArrayList<>(); - list.forEach(busProcessNew -> { - NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); - notifyTodoSendContext.setAppName("SPRS"); - notifyTodoSendContext.setModelId(busProcessNew.getId()); - notifyTodoSendContext.setModelName(busProcessNew.getTaskInfo()); - notifyTodoSendContext.setType("1"); - notifyTodoSendContext.setOptType("2"); - Map map = new HashMap<>(); - ResponseMessage byId = lawsUserInfoService.getById(busProcessNew.getUserId()); - map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); - JSONObject jsonLoginName = new JSONObject(map); - notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); - notifyTodoSendContext.setUserId(busProcessNew.getUserId()); - notifyTodoSendContexts.add(notifyTodoSendContext); - }); - for (NotifyTodoSendContext data: notifyTodoSendContexts){ - List notifyTodoSendContextArrayList = new ArrayList<>(); - notifyTodoSendContextArrayList.add(data); - Map map = new TreeMap<>(); - map.put("todoId",pId); - map.put("list",notifyTodoSendContextArrayList); - net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(map); - log.info("调用MQ数据!!!:"+jsonObject.toString()); - OASendLog oaSendLog = new OASendLog(); - oaSendLog.setType("delete"); - oaSendLog.setCreateTime(new Date()); - oaSendLog.setMeans("deleteOAByPid"); - oaSendLog.setMsgLog(jsonObject.toString()); - oaSendLogService.addOASendLog(oaSendLog); - oaService.setTodoDeleteMq(jsonObject.toString()); - } - } +// QueryWrapper queryWrapper1 = new QueryWrapper(); +// queryWrapper1.eq("P_ID",pId); +// List list = iBusProcessNewService.list(queryWrapper1); +// if(!list.isEmpty()){ +// List notifyTodoSendContexts = new ArrayList<>(); +// list.forEach(busProcessNew -> { +// NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); +// notifyTodoSendContext.setAppName("SPRS"); +// notifyTodoSendContext.setModelId(busProcessNew.getId()); +// notifyTodoSendContext.setModelName(busProcessNew.getTaskInfo()); +// notifyTodoSendContext.setType("1"); +// notifyTodoSendContext.setOptType("2"); +// Map map = new HashMap<>(); +// ResponseMessage byId = lawsUserInfoService.getById(busProcessNew.getUserId()); +// map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); +// JSONObject jsonLoginName = new JSONObject(map); +// notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); +// notifyTodoSendContext.setUserId(busProcessNew.getUserId()); +// notifyTodoSendContexts.add(notifyTodoSendContext); +// }); +// for (NotifyTodoSendContext data: notifyTodoSendContexts){ +// List notifyTodoSendContextArrayList = new ArrayList<>(); +// notifyTodoSendContextArrayList.add(data); +// Map map = new TreeMap<>(); +// map.put("todoId",pId); +// map.put("list",notifyTodoSendContextArrayList); +// net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(map); +// log.info("调用MQ数据!!!:"+jsonObject.toString()); +// OASendLog oaSendLog = new OASendLog(); +// oaSendLog.setType("delete"); +// oaSendLog.setCreateTime(new Date()); +// oaSendLog.setMeans("deleteOAByPid"); +// oaSendLog.setMsgLog(jsonObject.toString()); +// oaSendLogService.addOASendLog(oaSendLog); +// oaService.setTodoDeleteMq(jsonObject.toString()); +// } +// } } @Override @Async public NotifyTodoAppDeleteResult setTodoDelete(String object) throws Exception{ - Map objectMap = net.sf.json.JSONObject.fromObject(object); - List notifyTodoSendContexts = JSONObject.parseArray(objectMap.get("list").toString(), NotifyTodoSendContext.class); - NotifyTodoAppDeleteResult notifyTodoAppResult = new NotifyTodoAppDeleteResult(); - String result = ""; - SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); - - JsonSend jsonSend = new JsonSend(); - HEAD head = new HEAD(); - head.setACCOUNT("OA"); - head.setBIZTRANSACTIONID("SYC_161320210206133219"); - head.setCONSUMER("SPRS"); - head.setCOUNT("1"); - head.setPASSWORD("TEST_oa201611241710"); - head.setSRVLEVEL("1"); - List list = new ArrayList<>(); - list.addAll(notifyTodoSendContexts); - jsonSend.setHEAD(head); - jsonSend.setLIST(list); - net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonSend); - Map mapCtr = new TreeMap<>(); - mapCtr.put("Authorization",credentials); - log.info("处理完文件数据,开始请求发送删除接口数据:【"+sdf.format(new Date())+"】"); - log.info("删除当前处理的文件数据(josnSend):"+jsonSend.toString()); - log.info("删除当前处理的文件数据(Object):"+object); - result = okHttpUtil.postForJson("https://fesbnew.foton.com.cn/WP_FOTON_FSOA/APP_DOC_SERVICES/Proxy_Services/TA_OA/DOC_SYC_1020_SendRemoveTodo_PS",json.toString(),mapCtr); - log.info("请求发送删除接口完毕,返回响应状态:【"+sdf.format(new Date())+"】"); -// JSONObject jsonObject = JSONObject.parseObject(result); - if(!result.contains("操作成功")){ - log.error("请求发送删除接口出现异常:"+result); - notifyTodoAppResult.setSign("1"); - notifyTodoAppResult.setMassage(result); - log.info("删除失败当前处理的文件数据(josnSend):"+jsonSend.toString()); - log.info("删除失败当前处理的文件数据(Object):"+object); - }else { - log.info("--------------------------成功发送 ESP 删除待办 "+object+"----------------------------"); - log.info("okHttp请求发送删除接口成功结果:"+result); - notifyTodoAppResult = (NotifyTodoAppDeleteResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppDeleteResult.class); - } +// Map objectMap = net.sf.json.JSONObject.fromObject(object); +// List notifyTodoSendContexts = JSONObject.parseArray(objectMap.get("list").toString(), NotifyTodoSendContext.class); +// NotifyTodoAppDeleteResult notifyTodoAppResult = new NotifyTodoAppDeleteResult(); +// String result = ""; +// SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); +// +// JsonSend jsonSend = new JsonSend(); +// HEAD head = new HEAD(); +// head.setACCOUNT("OA"); +// head.setBIZTRANSACTIONID("SYC_161320210206133219"); +// head.setCONSUMER("SPRS"); +// head.setCOUNT("1"); +// head.setPASSWORD("TEST_oa201611241710"); +// head.setSRVLEVEL("1"); +// List list = new ArrayList<>(); +// list.addAll(notifyTodoSendContexts); +// jsonSend.setHEAD(head); +// jsonSend.setLIST(list); +// net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonSend); +// Map mapCtr = new TreeMap<>(); +// mapCtr.put("Authorization",credentials); +// log.info("处理完文件数据,开始请求发送删除接口数据:【"+sdf.format(new Date())+"】"); +// log.info("删除当前处理的文件数据(josnSend):"+jsonSend.toString()); +// log.info("删除当前处理的文件数据(Object):"+object); +// result = okHttpUtil.postForJson("https://fesbnew.foton.com.cn/WP_FOTON_FSOA/APP_DOC_SERVICES/Proxy_Services/TA_OA/DOC_SYC_1020_SendRemoveTodo_PS",json.toString(),mapCtr); +// log.info("请求发送删除接口完毕,返回响应状态:【"+sdf.format(new Date())+"】"); +//// JSONObject jsonObject = JSONObject.parseObject(result); +// if(!result.contains("操作成功")){ +// log.error("请求发送删除接口出现异常:"+result); +// notifyTodoAppResult.setSign("1"); +// notifyTodoAppResult.setMassage(result); +// log.info("删除失败当前处理的文件数据(josnSend):"+jsonSend.toString()); +// log.info("删除失败当前处理的文件数据(Object):"+object); +// }else { +// log.info("--------------------------成功发送 ESP 删除待办 "+object+"----------------------------"); +// log.info("okHttp请求发送删除接口成功结果:"+result); +// notifyTodoAppResult = (NotifyTodoAppDeleteResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppDeleteResult.class); +// } // try { // // } catch (Exception e) { // log.error(errMes, e.getMessage()); // } - return notifyTodoAppResult; + return null; } @Override @Async public void completeOA(Task task){ - CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class); - log.info("--------------------------ESP 发送已办任务----------------------------"); - SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); - NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); - notifyTodoSendContext.setAppName("SPRS"); - notifyTodoSendContext.setCreateTime(sdf.format(new Date())); - - QueryWrapper queryWrapper1 = new QueryWrapper(); - queryWrapper1.eq("P_ID",task.getProcessInstanceId()); - queryWrapper1.eq("TASK_ID",task.getId()); - List list = iBusProcessNewService.list(queryWrapper1); - if(!list.isEmpty()){ - notifyTodoSendContext.setModelId(list.get(0).getId()); - notifyTodoSendContext.setModelName(task.getName()); - notifyTodoSendContext.setOptType("1"); - Map map = new HashMap<>(); - ResponseMessage byId = lawsUserInfoService.getById(task.getAssignee()); - map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); - JSONObject jsonLoginName = new JSONObject(map); - notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); - notifyTodoSendContext.setUserId(task.getAssignee()); - oaService.setTodoDoneMq(notifyTodoSendContext); - } +// CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class); +// log.info("--------------------------ESP 发送已办任务----------------------------"); +// SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); +// NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); +// notifyTodoSendContext.setAppName("SPRS"); +// notifyTodoSendContext.setCreateTime(sdf.format(new Date())); +// +// QueryWrapper queryWrapper1 = new QueryWrapper(); +// queryWrapper1.eq("P_ID",task.getProcessInstanceId()); +// queryWrapper1.eq("TASK_ID",task.getId()); +// List list = iBusProcessNewService.list(queryWrapper1); +// if(!list.isEmpty()){ +// notifyTodoSendContext.setModelId(list.get(0).getId()); +// notifyTodoSendContext.setModelName(task.getName()); +// notifyTodoSendContext.setOptType("1"); +// Map map = new HashMap<>(); +// ResponseMessage byId = lawsUserInfoService.getById(task.getAssignee()); +// map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); +// JSONObject jsonLoginName = new JSONObject(map); +// notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); +// notifyTodoSendContext.setUserId(task.getAssignee()); +// oaService.setTodoDoneMq(notifyTodoSendContext); +// } } @Override @Async public NotifyTodoAppResult setTodoDone(NotifyTodoSendContext notifyTodoSendContext) throws Exception{ - NotifyTodoAppResult notifyTodoAppResult = new NotifyTodoAppResult(); - String result = ""; - SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); - - JsonSend jsonSend = new JsonSend(); - HEAD head = new HEAD(); - head.setACCOUNT("OA"); - head.setBIZTRANSACTIONID("SYC_161320210206133219"); - head.setCONSUMER("SPRS"); - head.setCOUNT("1"); - head.setPASSWORD("oa201611241710"); - head.setSRVLEVEL("1"); - List list = new ArrayList<>(); - list.add(notifyTodoSendContext); - jsonSend.setHEAD(head); - jsonSend.setLIST(list); - net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonSend); - Map mapCtr = new TreeMap<>(); - mapCtr.put("Authorization",credentials); - log.info("处理完文件数据,开始请求发送已办接口数据:【"+sdf.format(new Date())+"】"); - log.info("Done当前处理的文件数据(josnSend):"+jsonSend.toString()); - log.info("Done当前处理的文件数据(notifyTodoSendContext):"+notifyTodoSendContext.toString()); - result = okHttpUtil.postForJson("https://fesbnew.foton.com.cn/WP_FOTON_FSOA/APP_DOC_SERVICES/Proxy_Services/TA_OA/DOC_SYC_1021_SendNotifyTodo_PS",json.toString(),mapCtr); - log.info("请求发送已办接口完毕,返回响应状态:【"+sdf.format(new Date())+"】"); -// JSONObject jsonObject = JSONObject.parseObject(result); - if(!result.contains("操作成功")){ - log.error("请求发送已办接口出现异常:"+result); - log.info("Done当前处理的文件数据(josnSend):"+jsonSend.toString()); - log.info("Done当前处理的文件数据(notifyTodoSendContext):"+notifyTodoSendContext.toString()); - notifyTodoAppResult.setSIGN("1"); - notifyTodoAppResult.setMASSAGE(result); - }else { - log.info("--------------------------成功发送 ESP 已办 模块ID"+notifyTodoSendContext.getModelId()+"----------------------------"); - log.info("okHttp请求发送已办接口成功结果:"+result); - notifyTodoAppResult = (NotifyTodoAppResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppResult.class); - } +// NotifyTodoAppResult notifyTodoAppResult = new NotifyTodoAppResult(); +// String result = ""; +// SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); +// +// JsonSend jsonSend = new JsonSend(); +// HEAD head = new HEAD(); +// head.setACCOUNT("OA"); +// head.setBIZTRANSACTIONID("SYC_161320210206133219"); +// head.setCONSUMER("SPRS"); +// head.setCOUNT("1"); +// head.setPASSWORD("oa201611241710"); +// head.setSRVLEVEL("1"); +// List list = new ArrayList<>(); +// list.add(notifyTodoSendContext); +// jsonSend.setHEAD(head); +// jsonSend.setLIST(list); +// net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonSend); +// Map mapCtr = new TreeMap<>(); +// mapCtr.put("Authorization",credentials); +// log.info("处理完文件数据,开始请求发送已办接口数据:【"+sdf.format(new Date())+"】"); +// log.info("Done当前处理的文件数据(josnSend):"+jsonSend.toString()); +// log.info("Done当前处理的文件数据(notifyTodoSendContext):"+notifyTodoSendContext.toString()); +// result = okHttpUtil.postForJson("https://fesbnew.foton.com.cn/WP_FOTON_FSOA/APP_DOC_SERVICES/Proxy_Services/TA_OA/DOC_SYC_1021_SendNotifyTodo_PS",json.toString(),mapCtr); +// log.info("请求发送已办接口完毕,返回响应状态:【"+sdf.format(new Date())+"】"); +//// JSONObject jsonObject = JSONObject.parseObject(result); +// if(!result.contains("操作成功")){ +// log.error("请求发送已办接口出现异常:"+result); +// log.info("Done当前处理的文件数据(josnSend):"+jsonSend.toString()); +// log.info("Done当前处理的文件数据(notifyTodoSendContext):"+notifyTodoSendContext.toString()); +// notifyTodoAppResult.setSIGN("1"); +// notifyTodoAppResult.setMASSAGE(result); +// }else { +// log.info("--------------------------成功发送 ESP 已办 模块ID"+notifyTodoSendContext.getModelId()+"----------------------------"); +// log.info("okHttp请求发送已办接口成功结果:"+result); +// notifyTodoAppResult = (NotifyTodoAppResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppResult.class); +// } // try { // // } catch (Exception e) { // log.error(errMes, e.getMessage()); // } - return notifyTodoAppResult; + return null; } @Override @Async public NotifyTodoAppResult sendTodo(BusProcessNew busProcessNew) throws Exception{ - NotifyTodoAppResult notifyTodoAppResult = new NotifyTodoAppResult(); - String result = ""; - SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); - JsonSend jsonSend = new JsonSend(); - HEAD head = new HEAD(); - head.setACCOUNT("OA"); - head.setBIZTRANSACTIONID("SYC_161320210206133219"); - head.setCONSUMER("SPRS"); - head.setCOUNT("1"); - head.setPASSWORD("oa201611241710"); - head.setSRVLEVEL("1"); - List list = new ArrayList<>(); - NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); - // 待办来源的系统 - notifyTodoSendContext.setAppName("SPRS"); - //创建时间 - notifyTodoSendContext.setCreateTime(sdf.format(new Date())); - // 待办在原系统唯一标识 - notifyTodoSendContext.setModelId(busProcessNew.getId()); - //模块名称 - notifyTodoSendContext.setModelName(busProcessNew.getTaskInfo()); - //标题 - notifyTodoSendContext.setSubject(busProcessNew.getPrcName()); - //地址 - QueryWrapper queryWrapper = new QueryWrapper(); - queryWrapper.eq("PRC_ID", busProcessNew.getPId()); - BusProcessName busProcessName = iBusProcessNameService.getOne(queryWrapper); - String linkParam = "&taskIds="+busProcessNew.getTaskId()+"&prcId="+busProcessNew.getPId()+"&prcNum="+busProcessName.getPrcNum()+"&prcName="+busProcessNew.getPrcName(); - notifyTodoSendContext.setLink(webUrl+busProcessNew.getLink()+linkParam); - //待办类型 - notifyTodoSendContext.setType("1"); - - Map map = new HashMap<>(); - ResponseMessage byId = lawsUserInfoService.getById(busProcessNew.getUserId()); - map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); - JSONObject jsonLoginName = new JSONObject(map); - notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); - list.add(notifyTodoSendContext); - jsonSend.setHEAD(head); - jsonSend.setLIST(list); - net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonSend); - Map mapCtr = new TreeMap<>(); - mapCtr.put("Authorization",credentials); - log.info("处理完文件数据,开始请求发送待办接口数据:【"+sdf.format(new Date())+"】"); - log.info("sendTodo当前处理的文件数据(josnSend):"+jsonSend.toString()); - log.info("sendTodo当前处理的文件数据(notifyTodoSendContext):"+notifyTodoSendContext.toString()); - result = okHttpUtil.postForJson("https://fesbnew.foton.com.cn/WP_FOTON_FSOA/APP_DOC_SERVICES/Proxy_Services/TA_OA/DOC_SYC_1019_SendTodo_PS",json.toString(),mapCtr); - log.info("请求发送待办接口完毕,返回响应状态:【"+sdf.format(new Date())+"】"); -// JSONObject jsonObject = JSONObject.parseObject(result); - if(!result.contains("操作成功")){ - log.error("请求发送待办接口出现异常:"+result); - log.info("sendTodo当前处理的文件数据(josnSend):"+jsonSend.toString()); - log.info("sendTodo当前处理的文件数据(notifyTodoSendContext):"+notifyTodoSendContext.toString()); - notifyTodoAppResult.setSIGN("1"); - notifyTodoAppResult.setMASSAGE(result); - }else { - log.info("okHttp请求发送待办接口成功结果:"+result); - notifyTodoAppResult = (NotifyTodoAppResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppResult.class); - } +// NotifyTodoAppResult notifyTodoAppResult = new NotifyTodoAppResult(); +// String result = ""; +// SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); +// JsonSend jsonSend = new JsonSend(); +// HEAD head = new HEAD(); +// head.setACCOUNT("OA"); +// head.setBIZTRANSACTIONID("SYC_161320210206133219"); +// head.setCONSUMER("SPRS"); +// head.setCOUNT("1"); +// head.setPASSWORD("oa201611241710"); +// head.setSRVLEVEL("1"); +// List list = new ArrayList<>(); +// NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); +// // 待办来源的系统 +// notifyTodoSendContext.setAppName("SPRS"); +// //创建时间 +// notifyTodoSendContext.setCreateTime(sdf.format(new Date())); +// // 待办在原系统唯一标识 +// notifyTodoSendContext.setModelId(busProcessNew.getId()); +// //模块名称 +// notifyTodoSendContext.setModelName(busProcessNew.getTaskInfo()); +// //标题 +// notifyTodoSendContext.setSubject(busProcessNew.getPrcName()); +// //地址 +// QueryWrapper queryWrapper = new QueryWrapper(); +// queryWrapper.eq("PRC_ID", busProcessNew.getPId()); +// BusProcessName busProcessName = iBusProcessNameService.getOne(queryWrapper); +// String linkParam = "&taskIds="+busProcessNew.getTaskId()+"&prcId="+busProcessNew.getPId()+"&prcNum="+busProcessName.getPrcNum()+"&prcName="+busProcessNew.getPrcName(); +// notifyTodoSendContext.setLink(webUrl+busProcessNew.getLink()+linkParam); +// //待办类型 +// notifyTodoSendContext.setType("1"); +// +// Map map = new HashMap<>(); +// ResponseMessage byId = lawsUserInfoService.getById(busProcessNew.getUserId()); +// map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); +// JSONObject jsonLoginName = new JSONObject(map); +// notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); +// list.add(notifyTodoSendContext); +// jsonSend.setHEAD(head); +// jsonSend.setLIST(list); +// net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonSend); +// Map mapCtr = new TreeMap<>(); +// mapCtr.put("Authorization",credentials); +// log.info("处理完文件数据,开始请求发送待办接口数据:【"+sdf.format(new Date())+"】"); +// log.info("sendTodo当前处理的文件数据(josnSend):"+jsonSend.toString()); +// log.info("sendTodo当前处理的文件数据(notifyTodoSendContext):"+notifyTodoSendContext.toString()); +// result = okHttpUtil.postForJson("https://fesbnew.foton.com.cn/WP_FOTON_FSOA/APP_DOC_SERVICES/Proxy_Services/TA_OA/DOC_SYC_1019_SendTodo_PS",json.toString(),mapCtr); +// log.info("请求发送待办接口完毕,返回响应状态:【"+sdf.format(new Date())+"】"); +//// JSONObject jsonObject = JSONObject.parseObject(result); +// if(!result.contains("操作成功")){ +// log.error("请求发送待办接口出现异常:"+result); +// log.info("sendTodo当前处理的文件数据(josnSend):"+jsonSend.toString()); +// log.info("sendTodo当前处理的文件数据(notifyTodoSendContext):"+notifyTodoSendContext.toString()); +// notifyTodoAppResult.setSIGN("1"); +// notifyTodoAppResult.setMASSAGE(result); +// }else { +// log.info("okHttp请求发送待办接口成功结果:"+result); +// notifyTodoAppResult = (NotifyTodoAppResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppResult.class); +// } // try { // // @@ -425,7 +425,7 @@ public class WebServiceOAServiceImpl implements WebServiceOAService { // log.error(errMes, e.getMessage()); // } - return notifyTodoAppResult; + return null; } /** @@ -434,45 +434,45 @@ public class WebServiceOAServiceImpl implements WebServiceOAService { */ @Async public void deleteOAByPidInfo(String pId){ - CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class); - log.info("--------------------------ESP 批量发送删除待办任务----------------------------"); - - QueryWrapper queryWrapper1 = new QueryWrapper(); - queryWrapper1.eq("P_ID",pId); - List list = iBusProcessNewService.list(queryWrapper1); - if(!list.isEmpty()){ - List notifyTodoSendContexts = new ArrayList<>(); - list.forEach(busProcessNew -> { - NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); - notifyTodoSendContext.setAppName("SPRS"); - notifyTodoSendContext.setModelId(busProcessNew.getId()); - notifyTodoSendContext.setModelName("技术标准起草"); - notifyTodoSendContext.setType("1"); - notifyTodoSendContext.setOptType("2"); - Map map = new HashMap<>(); - ResponseMessage byId = lawsUserInfoService.getById(busProcessNew.getUserId()); - map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); - JSONObject jsonLoginName = new JSONObject(map); - notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); - notifyTodoSendContext.setUserId(busProcessNew.getUserId()); - notifyTodoSendContexts.add(notifyTodoSendContext); - }); - for (NotifyTodoSendContext data: notifyTodoSendContexts){ - List notifyTodoSendContextArrayList = new ArrayList<>(); - notifyTodoSendContextArrayList.add(data); - Map map = new TreeMap<>(); - map.put("todoId",pId); - map.put("list",notifyTodoSendContextArrayList); - net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(map); - log.info("调用MQ数据!!!:"+jsonObject.toString()); - OASendLog oaSendLog = new OASendLog(); - oaSendLog.setType("delete"); - oaSendLog.setCreateTime(new Date()); - oaSendLog.setMeans("deleteOAByPid"); - oaSendLog.setMsgLog(jsonObject.toString()); - oaSendLogService.addOASendLog(oaSendLog); - oaService.setTodoDeleteMq(jsonObject.toString()); - } - } +// CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class); +// log.info("--------------------------ESP 批量发送删除待办任务----------------------------"); +// +// QueryWrapper queryWrapper1 = new QueryWrapper(); +// queryWrapper1.eq("P_ID",pId); +// List list = iBusProcessNewService.list(queryWrapper1); +// if(!list.isEmpty()){ +// List notifyTodoSendContexts = new ArrayList<>(); +// list.forEach(busProcessNew -> { +// NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext(); +// notifyTodoSendContext.setAppName("SPRS"); +// notifyTodoSendContext.setModelId(busProcessNew.getId()); +// notifyTodoSendContext.setModelName("技术标准起草"); +// notifyTodoSendContext.setType("1"); +// notifyTodoSendContext.setOptType("2"); +// Map map = new HashMap<>(); +// ResponseMessage byId = lawsUserInfoService.getById(busProcessNew.getUserId()); +// map.put("LoginName",byId == null ? "" : byId.getData().getAccount()); +// JSONObject jsonLoginName = new JSONObject(map); +// notifyTodoSendContext.setTargets(jsonLoginName.toJSONString()); +// notifyTodoSendContext.setUserId(busProcessNew.getUserId()); +// notifyTodoSendContexts.add(notifyTodoSendContext); +// }); +// for (NotifyTodoSendContext data: notifyTodoSendContexts){ +// List notifyTodoSendContextArrayList = new ArrayList<>(); +// notifyTodoSendContextArrayList.add(data); +// Map map = new TreeMap<>(); +// map.put("todoId",pId); +// map.put("list",notifyTodoSendContextArrayList); +// net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(map); +// log.info("调用MQ数据!!!:"+jsonObject.toString()); +// OASendLog oaSendLog = new OASendLog(); +// oaSendLog.setType("delete"); +// oaSendLog.setCreateTime(new Date()); +// oaSendLog.setMeans("deleteOAByPid"); +// oaSendLog.setMsgLog(jsonObject.toString()); +// oaSendLogService.addOASendLog(oaSendLog); +// oaService.setTodoDeleteMq(jsonObject.toString()); +// } +// } } }