calyrex 3.6
parent
579a37175c
commit
a789dadb11
@ -0,0 +1,96 @@
|
||||
package com.weaver.seconddev.interfaces.workflow.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.interfaces.htjt.util.WebApi;
|
||||
import com.weaver.seconddev.interfaces.prop.ConfigProp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: calyrex
|
||||
* @CreateTime: 2025-03-11
|
||||
* @Description: getdjinfo接口调用
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping({"/papi/secondev/workflow/controller" })
|
||||
public class Getdjinfo_controller {
|
||||
|
||||
@Autowired
|
||||
private ConfigProp configProp;
|
||||
|
||||
@RequestMapping("/getgsjc")
|
||||
public WeaResult<JSONObject> run(@RequestParam Map<String,Object> params) {
|
||||
log.error("getgsjc_controller execute start");
|
||||
log.error("getgsjc_controller execute params : " + params);
|
||||
String gysbm = null2String(params.get("gysbm"));
|
||||
String cgzzbmzb = null2String(params.get("cgzzbmzb"));
|
||||
JSONObject jsonParams = new JSONObject();
|
||||
jsonParams.put("operate", "VENDOR-QUERY");
|
||||
jsonParams.put("executor", "vendorInforQueryService");
|
||||
JSONObject paramMap = new JSONObject();
|
||||
JSONObject data = new JSONObject();
|
||||
JSONArray vendorCodes = new JSONArray();
|
||||
String attr[] = gysbm.split(";");
|
||||
for(String vendorCode:attr){
|
||||
if(!"".equals(vendorCode)){
|
||||
vendorCodes.add(vendorCode);
|
||||
}
|
||||
}
|
||||
data.put("vendorCodes",vendorCodes);
|
||||
data.put("purOrgCode",cgzzbmzb);
|
||||
paramMap.put("data",data);
|
||||
jsonParams.put("paramMap",paramMap);
|
||||
log.error("getDjInfo param:"+jsonParams);
|
||||
String arsqueryurl = configProp.getSrmbacklisturl();
|
||||
String state = "";
|
||||
String msg = "";
|
||||
JSONArray djdata = new JSONArray();
|
||||
try {
|
||||
String apiData = WebApi.postConnection(arsqueryurl, jsonParams.toJSONString(), "POST");
|
||||
log.error("getDjInfo apiData:"+apiData);
|
||||
com.alibaba.fastjson.JSONObject datajson = JSON.parseObject(apiData);
|
||||
boolean success = datajson.getBoolean("success");
|
||||
msg = null2String(data.getString("message"));
|
||||
if(success){
|
||||
state = "S";
|
||||
com.alibaba.fastjson.JSONObject resultMap = datajson.getJSONObject("resultMap");
|
||||
djdata = resultMap.getJSONArray("data");
|
||||
}else{
|
||||
state = "E";
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("getDjInfo error:",e);
|
||||
state = "E";
|
||||
msg = "接口调用异常:"+e.getMessage();
|
||||
}
|
||||
JSONObject returnData = new JSONObject();
|
||||
returnData.put("state",state);
|
||||
returnData.put("msg",msg);
|
||||
returnData.put("djdata",djdata);
|
||||
log.error("getDjInfo returnData:"+returnData.toJSONString());
|
||||
return WeaResult.success(returnData);
|
||||
}
|
||||
|
||||
public static String null2String(String s){
|
||||
return s == null ? "" : s;
|
||||
}
|
||||
|
||||
public static String null2String(Object o){
|
||||
return o == null ? "" : o.toString();
|
||||
}
|
||||
|
||||
public static String null2String(String s1,String s2){
|
||||
return s1 == null ? (s2 == null ? "" : s2) : s1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue