提交 5170c395 编写于 作者: Crimson's avatar Crimson

usr代码,im更新ps状态(临时代码)--jianguile

上级 7fbb6f11
package com.ibiz.web.ht.service;
import com.alibaba.fastjson.JSONObject;
import com.ibiz.util.config.SysInfoProperties;
import com.ibiz.util.config.UniWFClientProperties;
import com.ibiz.util.domain.PSDEWF;
import com.ibiz.util.domain.PSDataEntity;
import com.ibiz.util.domain.WFInstance;
import com.ibiz.util.feign.FeignRequestInterceptor;
import com.ibiz.util.feign.UniWFFeignClient;
import com.ibiz.util.feign.suport.SearchContextFeignEncode;
import com.ibiz.web.WebApplication.WebClientProperties;
import com.ibiz.web.ht.domain.IM;
import com.ibiz.web.ht.feign.IMFeignClient;
import com.ibiz.web.ht.filter.IMSearchContext;
import com.ibiz.web.ps.domain.PS;
import com.ibiz.web.ps.service.PSService;
import feign.Client;
import feign.Contract;
import feign.Feign;
import feign.codec.Decoder;
import feign.codec.Encoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
@Service
@Primary
//public class UsrIMService extends IMService {
public class UsrIMService {
public class UsrIMService extends IMService {
// @Autowired
// PSService psService;
//
// @Autowired
// public UsrIMService(Decoder decoder, Encoder encoder, Client client, Contract contract, FeignRequestInterceptor feignRequestInterceptor,
// WebClientProperties webClientProperties, UniWFClientProperties uniWFClientProperties) {
// super(decoder, encoder, client, contract, feignRequestInterceptor, webClientProperties, uniWFClientProperties);
// }
//
// /**
// * 流程业务数据行为【WFAction】
// */
// @Override
// public JSONObject wfAction(String im_id, JSONObject data) {
// if (data == null
// || data.getString("type") == null
// || data.getString("wfinstanceid") == null) {
// System.err.println("传入参数缺失");
// data.put("rst", "0");
// data.put("msg", "传入参数缺失");
// return data;
// }
// String type = data.getString("type");
// String wfinstanceid = data.getString("wfinstanceid");
// String wfstep = data.getString("wfstep");
//
// // 业务实体
// IM im = this.get(im_id);
//
// WFInstance wfinstance = this.uniWFFeignClient.getWFInstance(wfinstanceid);
// if (wfinstance == null) {
// System.err.println("查询不到流程实例");
// data.put("rst", "0");
// data.put("msg", "查询不到流程实例");
// return data;
// }
// JSONObject psdewfCond = new JSONObject();
// psdewfCond.put("n_psworkflowid_eq", wfinstance.getPsworkflowid());
// psdewfCond.put("n_psdataentityid_eq", "6ebc01c300b54d50486ccff26162752b");
// Page<PSDEWF> psdewfs = this.uniWFFeignClient.getPSDEWFByCondition(psdewfCond);
// if (psdewfs == null || psdewfs.getContent().size() == 0) {
// data.put("rst", "0");
// data.put("msg", "未查到流程实体");
// return data;
// }
// PSDEWF psdewf = psdewfs.getContent().get(0);
//
// // PS
// PS ps = new PS();
//
// // 业务状态
// String status = null;
// if ("start".equals(type)) {
// status = psdewf.getProcessvalue();
// } else if ("gotostep".equals(type)) {
// status = psdewf.getProcessvalue();
// } else if ("finish".equals(type)) {
// status = psdewf.getFinishvalue();
// } else if ("cancel".equals(type)) {
//
// } else if ("error".equals(type)) {
// status = psdewf.getErrorvalue();
// }
//
// // 保存当前数据
// if (status != null && !status.isEmpty()) {
// im.setImwfstate(status);
// }
// if (wfstep != null && !wfstep.isEmpty()) {
// }
//
// // 保存业务数据
// this.update(im_id, im);
//
// if ("finish".equals(type)) {
// ps.setPSId(im.getIMId());
// ps = psService.get(ps.getPSId());
// if (ps != null) {
// ps.setImstate("30");
// psService.update(ps.getPSId(), ps);
// }
// }
//
// data.put("rst", "1");
// return data;
// }
@Autowired
PSService psService;
@Autowired
public UsrIMService(Decoder decoder, Encoder encoder, Client client, Contract contract, FeignRequestInterceptor feignRequestInterceptor,
WebClientProperties webClientProperties, UniWFClientProperties uniWFClientProperties) {
super(decoder, encoder, client, contract, feignRequestInterceptor, webClientProperties, uniWFClientProperties);
}
/**
* 流程业务数据行为【WFAction】
*/
@Override
public JSONObject wfAction(String im_id, JSONObject data) {
if (data == null
|| data.getString("type") == null
|| data.getString("wfinstanceid") == null) {
System.err.println("传入参数缺失");
data.put("rst", "0");
data.put("msg", "传入参数缺失");
return data;
}
String type = data.getString("type");
String wfinstanceid = data.getString("wfinstanceid");
String wfstep = data.getString("wfstep");
// 业务实体
IM im = this.get(im_id);
WFInstance wfinstance = this.uniWFFeignClient.getWFInstance(wfinstanceid);
if (wfinstance == null) {
System.err.println("查询不到流程实例");
data.put("rst", "0");
data.put("msg", "查询不到流程实例");
return data;
}
JSONObject psdewfCond = new JSONObject();
psdewfCond.put("n_psworkflowid_eq", wfinstance.getPsworkflowid());
psdewfCond.put("n_psdataentityid_eq", "6ebc01c300b54d50486ccff26162752b");
Page<PSDEWF> psdewfs = this.uniWFFeignClient.getPSDEWFByCondition(psdewfCond);
if (psdewfs == null || psdewfs.getContent().size() == 0) {
data.put("rst", "0");
data.put("msg", "未查到流程实体");
return data;
}
PSDEWF psdewf = psdewfs.getContent().get(0);
// PS
PS ps = new PS();
// 业务状态
String status = null;
if ("start".equals(type)) {
status = psdewf.getProcessvalue();
} else if ("gotostep".equals(type)) {
status = psdewf.getProcessvalue();
} else if ("finish".equals(type)) {
status = psdewf.getFinishvalue();
} else if ("cancel".equals(type)) {
} else if ("error".equals(type)) {
status = psdewf.getErrorvalue();
}
// 保存当前数据
if (status != null && !status.isEmpty()) {
im.setImwfstate(status);
}
if (wfstep != null && !wfstep.isEmpty()) {
}
// 保存业务数据
this.update(im_id, im);
if ("finish".equals(type)) {
ps.setPSId(im.getIMId());
ps = psService.get(ps.getPSId());
if (ps != null) {
ps.setImstate("30");
psService.update(ps.getPSId(), ps);
}
}
data.put("rst", "1");
return data;
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册