提交 24014e9f authored 作者: 李炎's avatar 李炎

过滤集成平台单,采购订单行项目号

上级 e43a8431
package org.jeecg.modules.iost.ims.ExternalInterface.Interface;
import java.util.Map;
public interface API {
public String add(Map<String, String> map);
public String select();
}
package org.jeecg.modules.iost.ims.ExternalInterface;
import org.jeecg.modules.iost.ims.ExternalInterface.Interface.API;
import org.jeecg.modules.iost.ims.Util.HttpUtil;
import org.jeecg.modules.iost.ims.Util.HttpUtils;
import org.jeecg.modules.iost.ims.Util.JsonUtil;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: 供应商重点原材料库存
*/
@Service
public class MaterialinventoryApi implements API {
private String url = "http://www.lingqingkeji.com:8080/wmssystem/API/eipmatinventory/";
private List<Map<String, Object>> lists = new ArrayList<Map<String,Object>>();
Map<String,String> hreader = new HashMap<>();
public MaterialinventoryApi(){
hreader.put("transno", "201910086843218<Az2eV3>");
hreader.put("orisys", "0");
hreader.put("Content-Type","application/json");
}
@Override
public String add(Map<String,String> map) {
hreader.put("operatetype", "add");
String result = null;
try {
result = HttpUtil.post(url+"add", JsonUtil.Mapjson(map),hreader);
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
@Override
public String select() {
String result = HttpUtils.getRequest(url, hreader,null);
return result;
}
}
package org.jeecg.modules.iost.ims.Util;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.config.ConnectionConfig;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.config.SocketConfig;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContexts;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import javax.net.ssl.SSLContext;
import java.io.IOException;
import java.nio.charset.Charset;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* <p>类名: HttpUtils</p>
* <p>描述: http请求工具类</p>
* <p>修改时间: 2019年04月30日 上午10:12:35</p>
*
* @author lidongyang
*/
public class HttpUtils {
public static String defaultEncoding = "utf-8";
/**
* 发送http post请求,并返回响应实体
*
* @param url 请求地址
* @return url响应实体
*/
public static String postRequest(String url) {
return postRequest(url, null, null);
}
/**
* <p>方法名: postRequest</p>
* <p>描述: 发送httpPost请求</p>
*
* @param url
* @param params
* @return
*/
public static String postRequest(String url, Map<String, Object> params) {
return postRequest(url, null, params);
}
/**
* 发送http post请求,并返回响应实体
*
* @param url 访问的url
* @param headers 请求需要添加的请求头
* @param params 请求参数
* @return
*/
public static String postRequest(String url, Map<String, String> headers,
Map<String, Object> params) {
String result = null;
CloseableHttpClient httpClient = buildHttpClient();
HttpPost httpPost = new HttpPost(url);
if (null != headers && headers.size() > 0) {
for (Entry<String, String> entry : headers.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
httpPost.addHeader(new BasicHeader(key, value));
}
}
if (null != params && params.size() > 0) {
List<NameValuePair> pairList = new ArrayList<NameValuePair>(params.size());
for (Entry<String, Object> entry : params.entrySet()) {
NameValuePair pair = new BasicNameValuePair(entry.getKey(), entry.getValue().toString());
pairList.add(pair);
}
httpPost.setEntity(new UrlEncodedFormEntity(pairList, Charset.forName(defaultEncoding)));
}
try {
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
HttpEntity entity = response.getEntity();
if (entity != null) {
result = EntityUtils.toString(entity,
Charset.forName(defaultEncoding));
}
} finally {
response.close();
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
/**
* 发送http get请求
*
* @param url 请求url
* @return url返回内容
*/
public static String getRequest(String url) {
return getRequest(url, null);
}
/**
* 发送http get请求
*
* @param url 请求的url
* @param params 请求的参数
* @return
*/
public static String getRequest(String url, Map<String, Object> params) {
return getRequest(url, null, params);
}
/**
* 发送http get请求
*
* @param url 请求的url
* @param headersMap 请求头
* @param params 请求的参数
* @return
*/
public static String getRequest(String url, Map<String, String> headersMap, Map<String, Object> params) {
String result = null;
CloseableHttpClient httpClient = buildHttpClient();
try {
String apiUrl = url;
if (null != params && params.size() > 0) {
StringBuffer param = new StringBuffer();
int i = 0;
for (String key : params.keySet()) {
if (i == 0)
param.append("?");
else
param.append("&");
param.append(key).append("=").append(params.get(key));
i++;
}
apiUrl += param;
}
HttpGet httpGet = new HttpGet(apiUrl);
if (null != headersMap && headersMap.size() > 0) {
for (Entry<String, String> entry : headersMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
httpGet.addHeader(new BasicHeader(key, value));
}
}
CloseableHttpResponse response = httpClient.execute(httpGet);
try {
HttpEntity entity = response.getEntity();
if (null != entity) {
result = EntityUtils.toString(entity, defaultEncoding);
}
} finally {
response.close();
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
/**
* 创建httpclient
*
* @return
*/
public static CloseableHttpClient buildHttpClient() {
try {
RegistryBuilder<ConnectionSocketFactory> builder = RegistryBuilder
.create();
ConnectionSocketFactory factory = new PlainConnectionSocketFactory();
builder.register("http", factory);
KeyStore trustStore = KeyStore.getInstance(KeyStore
.getDefaultType());
SSLContext context = SSLContexts.custom().useTLS()
.loadTrustMaterial(trustStore, new TrustStrategy() {
public boolean isTrusted(X509Certificate[] chain,
String authType) throws CertificateException {
return true;
}
}).build();
LayeredConnectionSocketFactory sslFactory = new SSLConnectionSocketFactory(
context,
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
builder.register("https", sslFactory);
Registry<ConnectionSocketFactory> registry = builder.build();
PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(
registry);
ConnectionConfig connConfig = ConnectionConfig.custom()
.setCharset(Charset.forName(defaultEncoding)).build();
SocketConfig socketConfig = SocketConfig.custom()
.setSoTimeout(100000).build();
manager.setDefaultConnectionConfig(connConfig);
manager.setDefaultSocketConfig(socketConfig);
return HttpClientBuilder.create().setConnectionManager(manager)
.build();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
}
\ No newline at end of file
package org.jeecg.modules.iost.ims.Util;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 把不同的数据类型转化成json类型字符串
*/
public class JsonUtil {
public static String Objectjson(Object obj) {
StringBuilder json = new StringBuilder();
if (obj == null) {
json.append("\"\"");
} else if (obj instanceof String || obj instanceof Integer || obj instanceof Float
|| obj instanceof Boolean || obj instanceof Short || obj instanceof Double
|| obj instanceof Long || obj instanceof BigDecimal || obj instanceof BigInteger
|| obj instanceof Byte) {
json.append("\"").append(Stringjson(obj.toString())).append("\"");
} else if (obj instanceof Object[]) {
json.append(array2json((Object[]) obj));
} else if (obj instanceof List) {
json.append(Listjson((List<?>) obj));
} else if (obj instanceof Map) {
json.append(Mapjson((Map<?, ?>) obj));
} else if (obj instanceof Set) {
json.append(Setjson((Set<?>) obj));
} else {
json.append(bean2json(obj));
}
return json.toString();
}
public static String Stringjson(String s) {
if (s == null)
return "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
switch (ch) {
case '"':
sb.append("\\\"");
break;
case '\\':
sb.append("\\\\");
break;
case '\b':
sb.append("\\b");
break;
case '\f':
sb.append("\\f");
break;
case '\n':
sb.append("\\n");
break;
case '\r':
sb.append("\\r");
break;
case '\t':
sb.append("\\t");
break;
case '/':
sb.append("\\/");
break;
default:
if (ch >= '\u0000' && ch <= '\u001F') {
String ss = Integer.toHexString(ch);
sb.append("\\u");
for (int k = 0; k < 4 - ss.length(); k++) {
sb.append('0');
}
sb.append(ss.toUpperCase());
} else {
sb.append(ch);
}
}
}
return sb.toString();
}
public static String array2json(Object[] array) {
StringBuilder json = new StringBuilder();
json.append("[");
if (array != null && array.length > 0) {
for (Object obj : array) {
json.append(Objectjson(obj));
json.append(",");
}
json.setCharAt(json.length() - 1, ']');
} else {
json.append("]");
}
return json.toString();
}
public static String Listjson(List<?> list) {
StringBuilder json = new StringBuilder();
json.append("[");
if (list != null && list.size() > 0) {
for (Object obj : list) {
json.append(Objectjson(obj));
json.append(",");
}
json.setCharAt(json.length() - 1, ']');
} else {
json.append("]");
}
return json.toString();
}
public static String Mapjson(Map<?, ?> map) {
StringBuilder json = new StringBuilder();
json.append("{");
if (map != null && map.size() > 0) {
for (Object key : map.keySet()) {
json.append(Objectjson(key));
json.append(":");
json.append(Objectjson(map.get(key)));
json.append(",");
}
json.setCharAt(json.length() - 1, '}');
} else {
json.append("}");
}
return json.toString();
}
public static String Setjson(Set<?> set) {
StringBuilder json = new StringBuilder();
json.append("[");
if (set != null && set.size() > 0) {
for (Object obj : set) {
json.append(Objectjson(obj));
json.append(",");
}
json.setCharAt(json.length() - 1, ']');
} else {
json.append("]");
}
return json.toString();
}
public static String bean2json(Object bean) {
StringBuilder json = new StringBuilder();
json.append("{");
PropertyDescriptor[] props = null;
try {
props = Introspector.getBeanInfo(bean.getClass(), Object.class).getPropertyDescriptors();
} catch (IntrospectionException e) {}
if (props != null) {
for (int i = 0; i < props.length; i++) {
try {
String name = Objectjson(props[i].getName());
String value = Objectjson(props[i].getReadMethod().invoke(bean));
json.append(name);
json.append(":");
json.append(value);
json.append(",");
} catch (Exception e) {}
}
json.setCharAt(json.length() - 1, '}');
} else {
json.append("}");
}
return json.toString();
}
}
\ No newline at end of file
package org.jeecg.modules.iost.ims.controller;
import java.text.ParseException;
import javax.servlet.http.HttpServletRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.iost.ims.entity.ImsSupplier;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.iost.ims.service.IImsSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 供应商信息
* @Author: jeecg-boot
* @Date: 2021-08-31
* @Version: V1.0
*/
@Api(tags="供应商基础信息")
@RestController
@RequestMapping("/IMS/imsSupplier")
@Slf4j
public class ImsSupplierController extends JeecgController<ImsSupplier, IImsSupplierService> {
@Autowired
private IImsSupplierService imsSupplierService;
/**
* 分页列表查询
*
* @param imsSupplier
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "供应商信息-分页列表查询")
@ApiOperation(value = "供应商信息-分页列表查询", notes = "供应商信息-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(ImsSupplier imsSupplier,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ImsSupplier> queryWrapper = QueryGenerator.initQueryWrapper(imsSupplier, req.getParameterMap());
Page<ImsSupplier> page = new Page<ImsSupplier>(pageNo, pageSize);
IPage<ImsSupplier> pageList = imsSupplierService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 同步
*
* @return
* @throws ParseException
*/
@AutoLog(value = "IMS供应商信息API-同步")
@ApiOperation(value = "IMS供应商信息API-同步", notes = "IMS供应商信息API-同步")
@PostMapping(value = "/synchronization")
public Result<?> synchronization() throws ParseException {
return Result.OK(imsSupplierService.synchronization(null));
}
}
\ No newline at end of file
package org.jeecg.modules.iost.ims.dto;
import java.util.HashMap;
import java.util.Map;
public class EIP {
public static final Map<Integer, String> entity = new HashMap<Integer, String>() {{
put(1, "获取合同和采购订单信息,生成销售订单");
put(2, "供货单");
put(3, "推送销售订单");
put(4, "推送生产订单");
put(5, "推送排产计划");
put(6, "重点材料");
put(7, "推送实物ID信息");
put(8, "备品备件");
put(9, "产成品");
}};
public static String getEIP(Integer id) {
return entity.get(id);
}
}
package org.jeecg.modules.iost.ims.dto;
import lombok.Data;
/**
*
*/
@Data
public class PageInfo {
/**当前页码*/
int pageNum;
/**每页条数*/
int pageSize;
/**页数*/
int pageCount;
/**总记录数*/
int total;
}
\ No newline at end of file
package org.jeecg.modules.iost.ims.dto;
import lombok.Data;
/**
* 返回体:返回json数据格式
*/
@Data
public class PurchaseordeRequest {
/**状态标识*/
String status ;
/**返回提示消息*/
String message;
Object data;
PageInfo pageInfo = new PageInfo();
}
package org.jeecg.modules.iost.ims.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.constant.CommonConstant;
import java.io.Serializable;
/**
* 接口返回数据格式
*/
@Data
@ApiModel(value = "接口返回对象", description = "接口返回对象")
public class Request<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 成功标志
*/
@ApiModelProperty(value = "成功标志")
private boolean success = true;
/**
* ?
*/
@ApiModelProperty(value = "成功标志")
private String type ;
/**
* ?
*/
@ApiModelProperty(value = "成功标志")
private String resultHint ;
/*
*/
/**
* 返回处理消息h
*//*
@ApiModelProperty(value = "返回处理消息")
private String message = "操作成功!";
*/
/**
* 返回代码
*/
//@ApiModelProperty(value = "返回代码")
// private Integer code = 0;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private T resultValue;
/**
* 时间戳
*/
// @ApiModelProperty(value = "时间戳")
// private long timestamp = System.currentTimeMillis();
/**
* 来源系统标识,1:网关;2:品类管理中心
*/
public Request() {
}
public Request<T> successful(String message) {
//this.message = message;
//this.code = CommonConstant.SC_OK_200;
this.success = true;
return this;
}
@Deprecated
public static Request<Object> ok() {
Request<Object> r = new Request<Object>();
r.setSuccess(true);
//r.setCode(CommonConstant.SC_OK_200);
//r.setMessage("成功");
r.setType("");
r.setResultHint("");
return r;
}
@Deprecated
public static Request<Object> ok(String msg) {
Request<Object> r = new Request<Object>();
r.setSuccess(true);
//r.setCode(CommonConstant.SC_OK_200);
//r.setMessage(msg);
r.setType("");
r.setResultHint("");
return r;
}
@Deprecated
public static Request<Object> ok(Object data) {
Request<Object> r = new Request<Object>();
r.setSuccess(true);
//r.setCode(CommonConstant.SC_OK_200);
//r.setResult(data);
r.setType("");
r.setResultHint("");
r.setResultValue(data);
return r;
}
public static <T> Request<T> OK() {
Request<T> r = new Request<T>();
r.setSuccess(true);
//r.setCode(CommonConstant.SC_OK_200);
// r.setMessage("成功");
r.setType("");
r.setResultHint("");
return r;
}
public static <T> Request<T> OK(T data) {
Request<T> r = new Request<T>();
r.setSuccess(true);
//r.setCode(CommonConstant.SC_OK_200);
//r.setResult(data);
r.setType("");
r.setResultHint("");
r.setResultValue(data);
return r;
}
public static <T> Request<T> OK(String msg, T data) {
Request<T> r = new Request<T>();
r.setSuccess(true);
//r.setCode(CommonConstant.SC_OK_200);
// r.setMessage(msg);
r.setType("");
r.setResultHint("");
r.setResultValue(data);
return r;
}
public static Request<Object> error(String msg) {
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
}
public static Request<Object> error10001(String msg) {
return error(10001, msg);
}
public static Request<Object> error(int code, String msg) {
Request<Object> r = new Request<Object>();
//r.setCode(code);
// r.setMessage(msg);
r.setType("");
r.setResultHint("");
r.setSuccess(false);
return r;
}
public Request<T> error500(String message) {
//this.message = message;
//this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
this.success = false;
return this;
}
/**
* 无权限访问返回结果
*/
public Request noauth(String msg) {
return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
}
@JsonIgnore
private String onlTable;
}
package org.jeecg.modules.iost.ims.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 接口返回数据格式
*/
@Data
@ApiModel(value = "接口返回对象", description = "接口返回对象")
public class RequestAnalysis implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 成功标志
*/
@ApiModelProperty(value = "成功标志")
private boolean successful = true;
/**
* ?
*/
@ApiModelProperty(value = "成功标志")
private String type ;
/**
* ?
*/
@ApiModelProperty(value = "成功标志")
private String resultHint ;
/*
*/
/**
* 返回处理消息h
*//*
@ApiModelProperty(value = "返回处理消息")
private String message = "操作成功!";
*/
/**
* 返回代码
*/
//@ApiModelProperty(value = "返回代码")
// private Integer code = 0;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private PurchaseordeRequest resultValue;
/**
* 时间戳
*/
// @ApiModelProperty(value = "时间戳")
// private long timestamp = System.currentTimeMillis();
/**
* 来源系统标识,1:网关;2:品类管理中心
*/
public RequestAnalysis() {
}
@JsonIgnore
private String onlTable;
}
package org.jeecg.modules.iost.ims.dto;
import java.io.Serializable;
public class imsRequest <T> implements Serializable {
private static final long serialVersionUID = 1L;
}
package org.jeecg.modules.iost.ims.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 供应商信息
* @Author: jeecg-boot
* @Date: 2021-08-31
* @Version: V1.0
*/
@Data
@TableName("ims_supplier")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="ims_supplier对象", description="供应商信息")
public class ImsSupplier implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**实体主键*/
@Excel(name = "实体主键", width = 15)
@ApiModelProperty(value = "实体主键")
private String fid;
/**供应商编码*/
@Excel(name = "供应商编码", width = 15)
@ApiModelProperty(value = "供应商编码")
private String supId;
/**供应商名称*/
@Excel(name = "供应商名称", width = 15)
@ApiModelProperty(value = "供应商名称")
private String supName;
/**禁用Y-N*/
@Excel(name = "禁用Y-N", width = 15)
@ApiModelProperty(value = "禁用Y-N")
private String disable;
/**ERP供应商编码*/
@Excel(name = "ERP供应商编码", width = 15)
@ApiModelProperty(value = "ERP供应商编码")
private String erpSupId;
/**使用组织编码*/
@Excel(name = "使用组织编码", width = 15)
@ApiModelProperty(value = "使用组织编码")
private String orgId;
/**数据创建时间*/
@Excel(name = "数据创建时间", width = 15)
@ApiModelProperty(value = "数据创建时间")
private String createtime;
}
package org.jeecg.modules.iost.ims.kingdeeapi.Interface;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
public interface web_api {
public String add(Object object);
public List<Map<String,String>> select(Map<String, String> map, String where) throws ParseException;
public String update(Object object);
}
package org.jeecg.modules.iost.ims.kingdeeapi;
import org.jeecg.modules.iost.ims.Dao.CategoryDao;
import org.jeecg.modules.iost.ims.kingdeeapi.Interface.web_api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 查询金蝶云供应商基本信息
*/
@Component
public class SupplierKingdeeApi implements web_api {
/**操作的单据体名称*/
private String sFormId = "BD_MATERIAL";
@Autowired
private CategoryDao categoryDao;
private Map<String,String> key = new LinkedHashMap<>();
public SupplierKingdeeApi(){
/*查询字段*/
key.put("FSupplierId","FSupplierId");//单据头实体主键
key.put("FNumber","FNumber");//编码
key.put("FName","FName");//名称
key.put("FForbidStatus","FForbidStatus");//禁用状态
key.put("FUseOrgId","FUseOrgId");//使用组织
key.put("FForbidStatus","FForbidStatus");//禁用状态
key.put("FCreateDate","FCreateDate");
}
@Override
public String add(Object object) {
return null;
}
/**
* 查询今天更新的数据
* @param map
* @param where
* @return
* @throws ParseException
*/
@Override
public List<Map<String, String>> select(Map<String, String> map, String where) throws ParseException {
SimpleDateFormat sdf1 =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );
Date d1= new Date();
String str1 = sdf1.format(d1);
//根据查询日期拿到明天
Calendar calendar = Calendar.getInstance();
calendar.setTime(d1);
calendar.add(Calendar.DATE,1);
String date=sdf1.format(calendar.getTime());
//查询今天更新的数据
List<List<Object>> list = categoryDao.selectdate(sFormId, key, new HashMap<String, String>() {{
put("FCreateDate", date);
}}, str1);
return Supplier(list,str1);
}
/**
* 查询每次更新的数据
* @param map
* @param where
* @param createtime
* @return
* @throws ParseException
*/
public List<Map<String, String>> selectupdate(Map<String, String> map, String where,String createtime) throws ParseException {
// 精确到秒
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date d1 = new Date();
String str1 = sdf1.format(d1);
//查询上次查询到现在更新的数据
List<List<Object>> list = categoryDao.selectdate(sFormId, key, new HashMap<String, String>() {{
put("FCreateDate", str1);
}}, createtime);
return Supplier(list,str1);
}
/**
* 将查询到的数据封装成本地字段
* @return
*/
private List<Map<String,String>> Supplier(List<List<Object>> list,String createtime){
List<Map<String,String>> salesorderlist = new ArrayList<>();
for (List<Object> list1:list) {
Map<String,String> salesordermap = new HashMap<>();
//获得物料编码
salesordermap.put("fid",list1.get(0).toString());
salesordermap.put("supId",list1.get(1).toString());
salesordermap.put("supName",list1.get(2).toString());
salesordermap.put("disable",list1.get(3).toString());
salesordermap.put("orgId",list1.get(5).toString());
//拿到查询时候的时间
salesordermap.put("createtime",createtime);
salesorderlist.add(salesordermap);
}
return salesorderlist;
}
@Override
public String update(Object object) {
return null;
}
}
package org.jeecg.modules.iost.ims.lanjieqi;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.modules.iost.ims.dto.PageInfo;
import org.jeecg.modules.iost.ims.dto.PurchaseordeRequest;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class Lanjieqi_API {
public static String Panduan(HttpServletRequest req){
Enumeration enumeration = req.getHeaderNames();
Map<String, String> map = new HashMap();
while (enumeration.hasMoreElements()) {
String headerName = (String) enumeration.nextElement();
String headValue = req.getHeader(headerName);
if (headerName.equals("orisys")){
map.put(headerName, headValue);
}
if (headerName.equals("transno")){
map.put(headerName, headValue);
}
if (headerName.equals("operatetype")){
map.put(headerName, headValue);
}
}
String jieguo = null;
if (!map.containsKey("orisys") || map.get("orisys") == null){
jieguo ="orisys是必填字段!";
}
if (!map.containsKey("transno") || map.get("transno") == null){
jieguo ="transno是必填字段!";
}
if (!map.containsKey("operatetype") || map.get("operatetype") == null){
jieguo="operatetype是必填字段!";
}
return jieguo;
}
public static PurchaseordeRequest autowired(IPage<?> page){
List<?> list = page.getRecords();
PurchaseordeRequest purchaseordeRequest = new PurchaseordeRequest();
purchaseordeRequest.setData(list);
PageInfo pageInfo = new PageInfo();
pageInfo.setPageSize((int)page.getSize());
//pageInfo.setPageCount(page.get);
pageInfo.setPageNum((int)page.getCurrent());
pageInfo.setTotal((int)page.getTotal());
pageInfo.setPageNum((int)page.getCurrent());
purchaseordeRequest.setPageInfo(pageInfo);
purchaseordeRequest.setMessage("成功");
purchaseordeRequest.setStatus("0000");
return purchaseordeRequest;
}
public static PurchaseordeRequest autowiredMap(Map<String,Object> map){
PurchaseordeRequest purchaseordeRequest = new PurchaseordeRequest();
purchaseordeRequest.setData(map);
PageInfo pageInfo = new PageInfo();
purchaseordeRequest.setPageInfo(pageInfo);
purchaseordeRequest.setMessage("成功");
purchaseordeRequest.setStatus("0000");
return purchaseordeRequest;
}
public static PurchaseordeRequest autowiredList(List list){
PurchaseordeRequest purchaseordeRequest = new PurchaseordeRequest();
purchaseordeRequest.setData(list);
PageInfo pageInfo = new PageInfo();
purchaseordeRequest.setPageInfo(pageInfo);
purchaseordeRequest.setMessage("成功");
purchaseordeRequest.setStatus("0000");
return purchaseordeRequest;
}
}
package org.jeecg.modules.iost.ims.mapper;
import org.jeecg.modules.iost.ims.entity.ImsSupplier;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 供应商信息
* @Author: jeecg-boot
* @Date: 2021-08-31
* @Version: V1.0
*/
public interface ImsSupplierMapper extends BaseMapper<ImsSupplier> {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.iost.ims.mapper.ImsSupplierMapper">
</mapper>
\ No newline at end of file
package org.jeecg.modules.iost.ims.service;
import net.sf.json.JSONObject;
import org.jeecg.modules.iost.ims.entity.ImsSupplier;
import com.baomidou.mybatisplus.extension.service.IService;
import java.text.ParseException;
import java.util.Map;
/**
* @Description: 供应商基础信息
* @Author: jeecg-boot
* @Date: 2021-08-31
* @Version: V1.0
*/
public interface IImsSupplierService extends IService<ImsSupplier> {
public JSONObject add(Map<String, String> map);
public JSONObject select(Map<String, String> map);
public Boolean synchronization(Object object) throws ParseException;
Boolean grid(Map<String, String> stringStringMap) throws ParseException;
}
package org.jeecg.modules.iost.ims.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.sf.json.JSONObject;
import org.jeecg.modules.iost.ims.entity.ImsSupplier;
import org.jeecg.modules.iost.ims.kingdeeapi.SupplierKingdeeApi;
import org.jeecg.modules.iost.ims.mapper.ImsSupplierMapper;
import org.jeecg.modules.iost.ims.service.IImsSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: 供应商基础信息
* @Author: jeecg-boot
* @Date: 2021-08-31
* @Version: V1.0
*/
@Service
public class ImsSupplierServiceImpl extends ServiceImpl<ImsSupplierMapper, ImsSupplier> implements IImsSupplierService {
@Autowired
SupplierKingdeeApi supplierKingdeeApi;
@Override
public JSONObject add(Map<String, String> map) {
return null;
}
@Override
public JSONObject select(Map<String, String> map) {
return null;
}
/**
* 从金蝶云同步供应商信息
* @param object
* @return
* @throws ParseException
*/
@Override
public Boolean synchronization(Object object) throws ParseException {
Boolean success = true;
return success;
}
@Override
public Boolean grid(Map<String, String> stringStringMap) throws ParseException {
return null;
}
}
package org.jeecg.modules.iost.ims.vo;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.constant.CommonConstant;
import java.io.Serializable;
/**
* 接口返回数据格式
*/
@Data
@ApiModel(value = "接口返回对象", description = "接口返回对象")
public class Request<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 成功标志
*/
@ApiModelProperty(value = "成功标志")
private boolean success = true;
/**
* 返回处理消息
*/
@ApiModelProperty(value = "返回处理消息")
private String message = "操作成功!";
/**
* 返回代码
*/
@ApiModelProperty(value = "返回代码")
private String code ;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private T result;
/**
* 时间戳
*/
@ApiModelProperty(value = "时间戳")
private long timestamp = System.currentTimeMillis();
/**
* 来源系统标识,1:网关;2:品类管理中心
*/
@ApiModelProperty(value = "来源系统标识")
private int orisys;
/**
* 返回请求报文中的交易流水号,方便排查问题
*/
@ApiModelProperty(value = "全局交易流水号")
private String transno;
/**
* 返回请求报文中的操作类型标识,方便排查问题
*/
@ApiModelProperty(value = "操作类型")
private String operatetype;
public Request() {
}
public Request(JSONObject jsonObject) {
if ( jsonObject.containsKey("orisys")){
orisys = (int)jsonObject.get("orisys");
}
if ( jsonObject.containsKey("transno")){
transno = (String) jsonObject.get("transno");
}
if ( jsonObject.containsKey("operatetype")){
operatetype = (String)jsonObject.get("operatetype");
}
}
public Request<T> success(String message) {
this.message = message;
// this.code = CommonConstant.SC_OK_200;
this.success = true;
return this;
}
@Deprecated
public Request<Object> ok() {
Request<Object> r = new Request<Object>();
r.setSuccess(true);
// r.setCode(CommonConstant.SC_OK_200);
r.setMessage("成功");
r.setOrisys(this.orisys);
r.setTransno(this.transno);
r.setOperatetype(this.operatetype);
return r;
}
@Deprecated
public Request<Object> ok(String msg) {
Request<Object> r = new Request<Object>();
r.setSuccess(true);
// r.setCode(CommonConstant.SC_OK_200);
r.setMessage(msg);
r.setOrisys(this.orisys);
r.setTransno(this.transno);
r.setOperatetype(this.operatetype);
return r;
}
@Deprecated
public Request<Object> ok(Object data) {
Request<Object> r = new Request<Object>();
r.setSuccess(true);
// r.setCode(CommonConstant.SC_OK_200);
r.setResult(data);
r.setOrisys(this.orisys);
r.setTransno(this.transno);
r.setOperatetype(this.operatetype);
return r;
}
public <T> Request<T> OK() {
Request<T> r = new Request<T>();
r.setSuccess(true);
// r.setCode(CommonConstant.SC_OK_200);
r.setMessage("成功");
r.setOrisys(this.orisys);
r.setTransno(this.transno);
r.setOperatetype(this.operatetype);
return r;
}
public <T> Request<T> OK(T data) {
Request<T> r = new Request<T>();
r.setSuccess(true);
// r.setCode(CommonConstant.SC_OK_200);
r.setResult(data);
r.setOrisys(this.orisys);
r.setTransno(this.transno);
r.setOperatetype(this.operatetype);
return r;
}
public <T> Request<T> OK(String msg, T data) {
Request<T> r = new Request<T>();
r.setSuccess(true);
// r.setCode(CommonConstant.SC_OK_200);
r.setMessage(msg);
r.setResult(data);
r.setOrisys(this.orisys);
r.setTransno(this.transno);
r.setOperatetype(this.operatetype);
return r;
}
public Request<Object> error(String msg) {
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
}
public Request<Object> error(int code, String msg) {
Request<Object> r = new Request<Object>();
// r.setCode(code);
r.setMessage(msg);
r.setSuccess(false);
return r;
}
public Request<T> error500(String message) {
this.message = message;
// this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
this.success = false;
return this;
}
/**
* 无权限访问返回结果
*/
public Request noauth(String msg) {
return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
}
@JsonIgnore
private String onlTable;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论