public JsonResult processHrWorkHandover(List<Map<String, Object>> list)throws Exception { Map<String, Object> map = list.get(0); String pkId =(String) map.get("pkId"); map.remove("companyId"); if (map.get("dateIn") != null){ Long dateIn = (Long) map.get("dateIn"); Date date1 = new Date(dateIn); String result1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date1); map.put("dateIn",result1); }

    if (map.get("dateOut") != null){
        Long dateOut = (Long) map.get("dateOut");
        Date date2 = new Date(dateOut);
        String result2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date2);
        map.put("dateOut",result2);
    }
    if (map.get("transferTime") != null){
        Long transferTime = (Long) map.get("transferTime");
        Date date3 = new Date(transferTime);
        String result3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date3);
        map.put("TransferTime",result3);

    }
    HrWorkHandoverBasic hrWork = hrWorkHandoverBasicMapper.selectById(pkId);
    if (Objects.isNull(hrWork)) {
        throw new IllegalArgumentException("pkId cannot be null");
    }
    String defId = SysPropertiesUtil.getString("handOverDefId");

    if(!StringUtils.isEmpty(hrWork.getBusKey())){
        JsonResult byBusKey = bpmClient.getByBusKey(defId, hrWork.getBusKey());
        if(byBusKey.getCode()!=200){
            logger.error("通过busKey 查询实例状态异常 {}",byBusKey.getMessage());
            throw new IllegalArgumentException(byBusKey.getMessage()+" "+byBusKey.getDetailMsg());
        }
        String data = (String) byBusKey.getData();
        if("RUNNING".equals(data) || "SUBMIT".equals(data) || "SUCCESS_END".equals(data) || "SUPSPEND".equals(data)){
            return JsonResult.getFailResult("存在流程业务单号【"+hrWork.getBusKey()+"】流程状态为:"+data+";不可重新提交");
        }
    }
    Map<String, String> workHandoverRecord = new HashMap<>();
    workHandoverRecord.put("handoverCategory", "");
    workHandoverRecord.put("handoverContent", "");
    workHandoverRecord.put("file", "");
    workHandoverRecord.put("remark", "");
    workHandoverRecord.put("handoverPerson", "");
    workHandoverRecord.put("reviewedBy", "");

    Map<String, Object> initData = new HashMap<>();
    initData.put("work_handover_secondary", workHandoverRecord);
    map.put("initData", initData);

    JSONObject jsonMap = new JSONObject(map);
    Map<String, Object> form0 = new HashMap<String, Object>();
    form0.put("start",jsonMap);
    JSONObject formObject = new JSONObject(form0);
    String formJson = formObject.toJSONString();//放到formJson里的

    Map<String, Object> formMap = new HashMap<String, Object>();
    formMap.put("defId",defId);
    formMap.put("systemHand",true);
    formMap.put("hasPk",false);
    formMap.put("formJson",formJson);
    //流程变量,空的对象字符串
    formMap.put("vars", JSON.toJSONString(new HashMap<String, Object>()));
    formMap.put("checkType","AGREE");
    String jsonP = JSON.toJSONString(formMap);
    JSONObject jsonObjectParams = JSON.parseObject(jsonP);
    //处理调用工作流后数据状态
    JsonResult jsonResult = bpmClient.startProcess(jsonObjectParams);
    if (jsonResult.getCode() == 200) {
        JSONObject o = (JSONObject)JSONObject.toJSON(jsonResult.getData());
        String instId = o.getString("instId");
        String busKey = o.getString("busKey");
        String actInstId = o.getString("actInstId");
        HrWorkHandoverBasic hrWorkHandoverBasic = new HrWorkHandoverBasic();
        hrWorkHandoverBasic.setId(pkId);
        hrWorkHandoverBasic.setInstId(instId);
        hrWorkHandoverBasic.setActInstId(actInstId);
        hrWorkHandoverBasic.setBusKey(busKey);
        hrWorkHandoverBasic.setInstStatus("SUBMIT");
        hrWorkHandoverBasicMapper.updateById(hrWorkHandoverBasic);
    }
    return jsonResult;
将这段代码的传入参数改为Listmap list 后面的代码做相应改变 public JsonResult processHrWorkHandoverMap mapthrows Exception String pkId =String mapgetpkId; mapremovecompanyId; if mapgetdateIn != null

原文地址: https://www.cveoy.top/t/topic/isCU 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录