You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
4.5 KiB
Java
125 lines
4.5 KiB
Java
2 years ago
|
package weaver.interfaces.kr.workflow.action;
|
||
|
|
||
|
import cn.hutool.http.HttpUtil;
|
||
|
import com.alibaba.fastjson.JSON;
|
||
|
import com.alibaba.fastjson.JSONObject;
|
||
|
import com.engine.kr.entity.kq.KqActionBO;
|
||
|
import com.engine.kr.entity.kq.KqGlobal;
|
||
|
import com.engine.kr.enums.KqInteractiveEnum;
|
||
|
import com.engine.kr.service.impl.KqInteractiveServiceImpl;
|
||
|
import weaver.general.BaseBean;
|
||
|
import weaver.interfaces.workflow.action.Action;
|
||
|
import weaver.soa.workflow.request.*;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* 康瑞-补卡申请流程-推送签卡数据Action
|
||
|
*
|
||
|
* @author wangj
|
||
|
* @version 1.00版本
|
||
|
* @Date 2023/6/5
|
||
|
*/
|
||
|
|
||
|
public class KrSignCreateAction implements Action {
|
||
|
@Override
|
||
|
public String execute(RequestInfo requestInfo) {
|
||
|
//单据编号
|
||
|
String billNo = "";
|
||
|
//申请人id
|
||
|
String personId = "";
|
||
|
//主表数据
|
||
|
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||
|
Property[] properties = mainTableInfo.getProperty();
|
||
|
for (Property property : properties) {
|
||
|
String name = property.getName();
|
||
|
String value = property.getValue();
|
||
|
switch (name) {
|
||
|
case "resourceId":
|
||
|
personId = KqActionBO.getWorkCode(value);
|
||
|
break;
|
||
|
case "lcbh":
|
||
|
billNo = value;
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
String token = new KqInteractiveServiceImpl().getToken();
|
||
|
String cfmBy = KqActionBO.getUserName(requestInfo.getLastoperator());
|
||
|
Map<String, String> operateDateTime = KqActionBO.getOperateDateTime(requestInfo.getRequestid());
|
||
|
|
||
|
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||
|
DetailTable detailTable = detailTableInfo.getDetailTable()[0];
|
||
|
Row[] rows = detailTable.getRow();
|
||
|
boolean isRun = true;
|
||
|
int index = 1;
|
||
|
for (Row row : rows) {
|
||
|
if (!isRun) {
|
||
|
break;
|
||
|
}
|
||
|
String signDate = "";
|
||
|
String signTime1 = "";
|
||
|
|
||
|
String signReason = "";
|
||
|
|
||
|
Cell[] cells = row.getCell();
|
||
|
for (Cell cell : cells) {
|
||
|
String name = cell.getName();
|
||
|
String value = cell.getValue();
|
||
|
switch (name) {
|
||
|
case "detail_signdate":
|
||
|
signDate = value;
|
||
|
break;
|
||
|
case "detail_signtime":
|
||
|
signTime1 = value;
|
||
|
break;
|
||
|
case "bksm":
|
||
|
signReason = value;
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
// 每一行发起一次请求
|
||
|
Map<String, Object> params = new HashMap<>();
|
||
|
params.put("token", token);
|
||
|
params.put("personId", personId);
|
||
|
params.put("billNo", billNo + "-" + index);
|
||
|
params.put("signDate", signDate);
|
||
|
params.put("signTime1", signTime1);
|
||
|
params.put("signTime2", null);
|
||
|
params.put("signTime3", null);
|
||
|
params.put("signTime4", null);
|
||
|
params.put("signTime5", null);
|
||
|
params.put("signTime6", null);
|
||
|
|
||
|
params.put("signReason", signReason);
|
||
|
params.put("addBy", requestInfo.getCreatorid());
|
||
|
params.put("addDay", operateDateTime.get("addDay"));
|
||
|
params.put("cfmBy", cfmBy);
|
||
|
params.put("cfmDay", operateDateTime.get("cfmDay"));
|
||
|
// 1新增、2变动、3取消
|
||
|
params.put("billStat", 1);
|
||
|
new BaseBean().writeLog("########批量补卡申请流程,requestid={" + requestInfo.getRequestid() + "],传参:" + JSON.toJSONString(params));
|
||
|
|
||
|
String returnStr = HttpUtil.post(KqGlobal.POST_URL + KqInteractiveEnum.SIGN_CREATE.getPostPath(), params);
|
||
|
new BaseBean().writeLog("########批量补卡申请流程,requestid={" + requestInfo.getRequestid() + "],接口响应数据:" + returnStr);
|
||
|
|
||
|
JSONObject jsonObject = JSONObject.parseObject(returnStr);
|
||
|
String code = jsonObject.getString("code");
|
||
|
if (!KqGlobal.SUC_CODE.equals(code)) {
|
||
|
requestInfo.getRequestManager().setMessagecontent(jsonObject.getString("msg"));
|
||
|
isRun = false;
|
||
|
}
|
||
|
index++;
|
||
|
}
|
||
|
|
||
|
if (isRun) {
|
||
|
return SUCCESS;
|
||
|
}
|
||
|
return FAILURE_AND_CONTINUE;
|
||
|
}
|
||
|
|
||
|
}
|