diff --git a/adc-da-activiti/src/main/java/com/adc/da/workFlow/controller/WorkFlowController.java b/adc-da-activiti/src/main/java/com/adc/da/workFlow/controller/WorkFlowController.java index b87d2f0a..3effd7b0 100644 --- a/adc-da-activiti/src/main/java/com/adc/da/workFlow/controller/WorkFlowController.java +++ b/adc-da-activiti/src/main/java/com/adc/da/workFlow/controller/WorkFlowController.java @@ -28,6 +28,7 @@ import com.adc.da.workFlow.dao.ExportExcelMapper; import com.adc.da.workFlow.entity.*; import com.adc.da.workFlow.service.WorkFlowService; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import oracle.ucp.proxy.annotation.Post; @@ -39,6 +40,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; +import springfox.documentation.spring.web.json.Json; import sun.misc.BASE64Encoder; import javax.servlet.http.HttpServletRequest; @@ -48,6 +50,7 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -1002,4 +1005,94 @@ public class WorkFlowController { return workFlowFeignClient.selectWenDan(taskId); } + @ApiOperation(value = "批量发送待办任务(正常走流程)") + @GetMapping("/batchToDoTasks") + public ResponseMessage batchToDoTasks(String json){ + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + //获取所有数据 + JSONObject jsonObject = JSONObject.parseObject(json); + List esRevisePlans = iEsRevisePlanService.batchToDoTasks(json); + String userId = ""; + String userName = ""; + Object userIdObject = jsonObject.get("prcCreateUser"); + if(userIdObject!=null){ + userId = userIdObject.toString(); + userName = userService.userIdByName(userId); + } + + //循环数据 + for (EsRevisePlan data : esRevisePlans){ + //数据拼接 + ProcessRollBackEO processRollBackEO = new ProcessRollBackEO(); + processRollBackEO.setUserId(userId); + processRollBackEO.setType("25"); + //拼接json + HashMap qbfsForm = new HashMap<>(); + HashMap qbfsFormInfo = new HashMap<>(); + qbfsForm.put("bussSort",data.getBussSort()); + qbfsForm.put("esMatingRelations",data.getEsMatingRelations()); + qbfsForm.put("technologic",data.getTechnologic()); + qbfsForm.put("useLevel",data.getUseLevel()); + qbfsForm.put("isRelate",data.getIsRelate()); + qbfsForm.put("esStandRelations",data.getEsStandRelations()); + //数组格式 + String[] split = data.getArea().split(","); + qbfsForm.put("area",split); + qbfsForm.put("tsJson",data.getTsJson()); + qbfsForm.put("tsJsonName",data.getTsJsonName()); + qbfsForm.put("rqbJson",data.getRqbJson()); + qbfsForm.put("rqbName",data.getRqbName()); + qbfsForm.put("unit",data.getUnit()); + qbfsForm.put("unitName",data.getUnitName()); + qbfsForm.put("esName",data.getEsName()); + qbfsForm.put("planStatus",data.getPlanStatus()); + qbfsForm.put("reviseStatus",data.getReviseStatus()); + qbfsForm.put("resPerson",data.getResPerson()); + qbfsForm.put("resPersonName",data.getResPersonName()); + + String wgLeaderStr = data.getWgLeader(); + if(wgLeaderStr!=null){ + if(wgLeaderStr.endsWith(",")){ + wgLeaderStr = wgLeaderStr.substring(0,wgLeaderStr.length()-1); + } + } + qbfsForm.put("wgLeader",wgLeaderStr); + qbfsForm.put("wgLeaderName",data.getWgLeaderName()); + qbfsForm.put("draftTime",simpleDateFormat.format(data.getDraftTime())); + qbfsForm.put("releaseTime",simpleDateFormat.format(data.getReleaseTime())); + qbfsForm.put("drafter",data.getDrafter()); + qbfsForm.put("drafterName",data.getDrafterName()); + qbfsForm.put("LXD",data.getLxd()); + qbfsForm.put("LXDName",""); + //争议 + qbfsForm.put("lxd",""); + //争议 + qbfsForm.put("lxdName","立项单"); + qbfsForm.put("addFlag","1"); + if(jsonObject.get("prcCreateUser")!=null){ + qbfsForm.put("prcCreateUser",jsonObject.get("prcCreateUser").toString()); + qbfsForm.put("prcCreateUserName",userName); + } + qbfsForm.put("nowEsId","操作成功"); + qbfsForm.put("type","5"); + String jsonMap = JSONObject.toJSONString(qbfsForm); + qbfsFormInfo.put("qbfsForm",qbfsForm); + processRollBackEO.setJson(JSONObject.toJSONString(qbfsFormInfo)); + ResponseMessage responseMessage = startProcessRollBack(processRollBackEO); + if(responseMessage!=null){ + String taskId = responseMessage.getData().toString(); + BusMes busMes = new BusMes(); + busMes.setPrcType("25"); + busMes.setTaskIds(taskId); + busMes.setCreateUserName(userName); + if(jsonObject.get("prcCreateUser")!=null){ + busMes.setUserId(jsonObject.get("prcCreateUser").toString()); + } + busMes.setJson(jsonMap); + Wrapper stringWrapper = completeTaskByUserId(busMes); + } + } + return Result.success(); + } + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/esRevisePlan/service/IEsRevisePlanService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/esRevisePlan/service/IEsRevisePlanService.java index 21febadf..671ff8c2 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/esRevisePlan/service/IEsRevisePlanService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/esRevisePlan/service/IEsRevisePlanService.java @@ -2,6 +2,7 @@ package com.adc.da.slrs.esRevisePlan.service; import com.adc.da.http.ResponseMessage; import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.service.IService; import java.util.Date; @@ -34,4 +35,6 @@ public interface IEsRevisePlanService extends IService { List getAllPlansByWkInfo(); + List batchToDoTasks(String json); + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/esRevisePlan/service/impl/EsRevisePlanServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/esRevisePlan/service/impl/EsRevisePlanServiceImpl.java index 7f93b5bb..def59e5e 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/esRevisePlan/service/impl/EsRevisePlanServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/esRevisePlan/service/impl/EsRevisePlanServiceImpl.java @@ -53,11 +53,9 @@ public class EsRevisePlanServiceImpl extends ServiceImpl getAllPlans(EsRevisePlan esRevisePlan) { Integer count = esRevisePlanDao.getTotal(); @@ -248,4 +246,20 @@ public class EsRevisePlanServiceImpl extends ServiceImpl batchToDoTasks(String json) { + JSONObject jsonObject = JSONObject.parseObject(json); + Object ids = jsonObject.get("ids"); + List esRevisePlans = new ArrayList(); + if(ids!=null){ + String[] split = ids.toString().split(","); + List idsList = Arrays.asList(split); + for (String id : idsList){ + EsRevisePlan esRevisePlan = this.baseMapper.selectById(id); + esRevisePlans.add(esRevisePlan); + } + } + return esRevisePlans; + } }