Commit 07c2c7bf authored by 赵啸非's avatar 赵啸非

修改接口接入规则

parent a5ee159b
Pipeline #2696 failed with stages
package com.mortals.xhx.busiz.req;
import lombok.Data;
@Data
public class ApiThirdPartyReq<T> {
/**
* 结果编码
*/
private int code;
/**
* 结果描述
*/
private String msg;
private Integer type;
/**
* 响应数据
*/
private T data;
}
package com.mortals.xhx.busiz.req;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.mortals.xhx.base.framework.CustomJsonDateDeserializer;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class TestReq implements Serializable {
/**
* 1:新增,2:修改,3:删除,4:激活,5:启用,6:停用
*/
private Integer receiveMethod;
// /**
// * 平台系统id
// */
// private Long platformId;
// /**
// * 平台系统编码
// */
// private String platformCode;
/**
* 产品id
*/
private Long productId;
/**
* 产品编码
*/
private String productCode;
/**
* 设备生产厂商ID
*/
private Long deviceFirmId;
/**
* 设备生产厂商名称
*/
private String deviceFirmname;
/**
* 设备名称
*/
private String deviceName;
/**
* 设备编码(暂定mac地址)
*/
private String deviceCode;
/**
* 设备Mac
*/
private String deviceMac;
/**
* 所属站点Id
*/
private Long siteId;
/**
* 所属站点编码
*/
private String siteCode;
/**
* 所属站点名称
*/
private String siteName;
/**
* 设备备注信息
*/
private String deviceRemark;
/**
* 设备
*/
private String homeUrl;
/**
* 设备访问ip
*/
private String ip;
/**
* 中心设备编码
*/
private String centernum;
/**
* 端口
*/
private String port;
/**
* 经度
*/
private String lon;
/**
* 纬度
*/
private String lati;
/**
* 楼层
*/
private Integer deviceInBuilding;
/**
* 所属楼栋
*/
private Integer deviceInFloor;
/**
* 负责人
*/
private String leadingOfficial;
/**
* 联系电话
*/
private String leadingOfficialTelephone;
/**
* 保修期至
*/
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
private Date defectsLiabilityPeriod;
/**
* 设备状态 (0.未激活,1.离线,2.在线)
*/
private Integer deviceStatus;
/**
* 设备来源(0.旧设备,1.新设备)
*/
private Integer source;
/**
* 激活(0.否,1.是)
*/
private Integer active;
/**
* 设备版本信息
*/
private String deviceVersion;
}
package com.mortals.xhx.busiz.req;
import com.mortals.xhx.common.pdu.device.DeviceReq;
import lombok.Data;
import java.util.List;
@Data
public class UploadDeviceReq extends DeviceReq {
private List<String> deviceCodeList;
private String content;
}
...@@ -12,7 +12,6 @@ import com.mortals.framework.common.Rest; ...@@ -12,7 +12,6 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.busiz.req.ComplexImplementationReq; import com.mortals.xhx.busiz.req.ComplexImplementationReq;
import com.mortals.xhx.busiz.req.UploadDeviceReq;
import com.mortals.xhx.busiz.rsp.ApiResp; import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.busiz.rsp.ComplexApiResp; import com.mortals.xhx.busiz.rsp.ComplexApiResp;
import com.mortals.xhx.busiz.rsp.ImplementEventInfo; import com.mortals.xhx.busiz.rsp.ImplementEventInfo;
......
...@@ -121,4 +121,10 @@ public final class Constant { ...@@ -121,4 +121,10 @@ public final class Constant {
*/ */
public static final Integer HTTP_TIMEOUT = 10; public static final Integer HTTP_TIMEOUT = 10;
/**
* redis保存响应信息时间,单位秒
*/
public static final Integer REDIS_RESP_TIMEOUT = 60;
} }
package com.mortals.xhx.protocol.complex.matter.model.req;
import lombok.Data;
import java.io.Serializable;
@Data
public class BaseReq implements Serializable {
private String nonce;
}
...@@ -9,10 +9,10 @@ import lombok.Data; ...@@ -9,10 +9,10 @@ import lombok.Data;
* @date: 2023/10/30 16:50 * @date: 2023/10/30 16:50
*/ */
@Data @Data
public class ImplementationReq { public class ImplementationReq extends BaseReq {
private Integer currentPage; private Integer currentPage;
private Integer pageSize; private Integer pageSize;
private String eventObjectType; private String eventObjectType;
...@@ -21,7 +21,5 @@ public class ImplementationReq { ...@@ -21,7 +21,5 @@ public class ImplementationReq {
private String implementName; private String implementName;
private String nonce;
} }
package com.mortals.xhx.protocol.complex.matter.model.rsp.implement;
import lombok.Data;
@Data
public class EventCharacterMap{
private String lbjg;
private String sdnbyqdyj;
private String bmjdtsfs;
private String bllcsm;
private String yyqd;
private String gdxzxkcxdyj;
private String gbslxzdzqdw;
private String sfxmmc;
private String zslxztjxssxzxkdfs;
private String sdqd;
private String xzxkzmc;
private String fwdx;
private String fwdtbldd;
private String state;
private String bmzxfs;
private String xzxkzjdyxdyfw;
private String jsjdsfdjdddd;
private String sfqzsx;
private String fwdtblsj;
private String sfxyzjpd;
private Integer userId;
private String sfqxhf;
private String gdzslxztjxssxzxkfsdyj;
private String yywz;
private String bsqtfl;
private String yddsfdjdddd;
private String sfxyzbpmgpjy;
private String ifWorkingDayTimed;
private String zjfwsxmc;
private String autoLimitTimeAlertPercent;
private String jdxbl;
private String tbcx;
private String gkwsnr;
private String njsfsf;
private String cnbjsxdw;
private String yxxt;
private String sfyjwj;
private String gdxzxkzyxdyfwdyj;
private Integer dbsxccs;
private String sfyxjm;
private String xzxkzdyxqxdw;
private String ywzjfwsx;
private String bllc;
private String nsnj;
private String bljgsdfs;
private String eventId;
private String yxjmyj;
private String spjgyb;
private String bmbldd;
private String gkfs;
private String xzxksxlx;
private String njzqqtsm;
private String gdxzxktjdyj;
private String ywxzxkslxz;
private String bmblsj;
private String xzgxd;
private String tbfw;
private String xzxkzjdyxdyfwqtsm;
private String tgnjdzmhbz;
private Integer yxsj;
private String zslxztjxssxzxkdqtfssm;
private String sfyj;
private String gbslxzdqtfssm;
private String sdzjfwsxdyij;
private String sflhbl;
private String fwqd;
private String wbdz;
private String ywblxkzm;
private String gknr;
private String yydd;
private String xscj;
private String zjfwsxsfxz;
private Integer legalLimitTime;
private String scbz;
private String sfsxgzcnbl;
private String cjsqmc;
private String zjmllx;
private String sfxyxcky;
private String qzsxmc;
private String yddbldd;
private String gdxzxkzjyxqxdyj;
private String nbzqqtsm;
private String ssztbm;
private String blxzxkzjyxsxdyq;
private String njsfxybscl;
private String sfzcrzhy;
private String cnbjsxsm;
private String sltj;
private String gbslxzdfs;
private String njzq;
private String sfszbz;
private String bllct;
private String gkqd;
private String xsnr;
private String ywnjyq;
private String sfxyxshgs;
private String sfzcyy;
private String sfxyzztz;
private String sdnjyqdyj;
private String ywnbyq;
private String fwdtzxfs;
private String wzhxtmc;
private String unitOfLimitTime;
private String fdbjsxdw;
private String sfsf;
private String fwdtjdtsfs;
private String zyxzxkdtj;
private String ssztxz;
private String jgyblx;
private String nbzq;
private String yddz;
private String jsjdzxbltzdd;
private Integer legalTransferLimitTime;
private String legalTransferLimitTimeIllustrate;
private String qlly;
private String sfxyjd;
private String sfbz;
private Integer promiseLimitTime;
private String xzxkzdyxqx;
private String smzqfl;
private String qxhfbz;
private String nbbsclmc;
private String fdbjsxsm;
private String spjgmc;
private String bxxcblyysm;
private Double limitTimeAlertPercent;
private String sfcqyx;
private String blxs;
private String xzjddm;
private String cjsqbm;
private String chargeNoticeTemplate;
private String eventImplementationDynamicCharacterId;
private String sdxgyq;
private String stateDate;
private String blsjd;
private String sfxyjyjcjy;
private String tgzjfwsxdjg;
private String bjlx;
private String sjr;
private String xzjdmc;
}
\ No newline at end of file
package com.mortals.xhx.protocol.complex.matter.model.rsp.implement;
import lombok.Data;
@Data
public class ImplementDetailInfo{
private String factSheet;
private String sourceId;
private Object deptName;
private Object endDate;
private String onlineReservation;
private Object afternoonStartTime;
private String implementCoding;
private String runNumbers;
private Object typeIdFr;
private String eventObjectType;
private String crossFlag;
private String selfServiceTerminals;
private Object dfjha;
private String implementName;
private Object electronicSealPath;
private Object classificationDfZrr;
private Object depthId;
private Object afternoonEndTime;
private String state;
private String handlingItemCode;
private String logisticeExpress;
private Integer limitNum;
private String eventId;
private Integer useId;
private Object legalLimitTime;
private Integer deptId;
private String eventType;
private String eventHandleKind;
private Object extend;
private Object contrastRatio;
private String xsfs;
private Object typeIdZrr;
private String areaCode;
private Object hotNum;
private Object thingEventId;
private Object promiseLimitTime;
private String sourceType;
private Object classificationDfFr;
private Object eventHandleKindDesc;
private Object formData;
private String checkInExplanation;
private Object accessGrant;
private Object startDate;
private Object dfjhaType;
private String integrationMatterName;
private String integrationInputName;
private String includeIntegration;
private String remark;
private Object thingSituation;
private String delFlag;
private Object morningEndTime;
private Object isApproval;
private String localAndIntegrationIdentical;
private String fullOnlineHandle;
private Integer businessFlowId;
private String parentEventId;
private Object assHandle;
private String onlinePayment;
private Object isSecondsDo;
private Object requestType;
private String resultsHandlingType;
private String enterHall;
private String onlineHandleSystem;
private Object eventTypeDetail;
private Object optionalWeek;
private EventCharacterMap eventCharacterMap;
private Object morningStartTime;
private Object thingId;
private Object schedulingRules;
private Object specifyTime;
private String checkIn;
private String ecId;
private Object eventTypeName;
private String networkOffice;
private Object settledFilePath;
private Object bjlx;
private String stateDate;
private Object unitOfLimitTime;
private Object resultsDefines;
}
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.mortals.xhx.protocol.complex.matter.model.req.ImplementationReq; ...@@ -9,6 +9,7 @@ import com.mortals.xhx.protocol.complex.matter.model.req.ImplementationReq;
import com.mortals.xhx.protocol.complex.matter.model.rsp.AcceptRspInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.AcceptRspInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.LoginRspInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.LoginRspInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.MatterListInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.MatterListInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.implement.ImplementDetailInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.matter.MatterWorkInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.matter.MatterWorkInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.work.WorkInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.work.WorkInfo;
...@@ -76,4 +77,14 @@ public interface IComplexMatterService extends IComplexService { ...@@ -76,4 +77,14 @@ public interface IComplexMatterService extends IComplexService {
Rest<WorkInfo> getWorkMatter(String deviceLogo, String eventIds); Rest<WorkInfo> getWorkMatter(String deviceLogo, String eventIds);
/**
* 通过id获取事项详细
*
* @param deviceLogo
* @param eventId
* @return
*/
Rest<ImplementDetailInfo> getImplement(String deviceLogo, String eventId);
} }
...@@ -15,6 +15,7 @@ import com.mortals.xhx.protocol.complex.matter.model.req.ImplementationReq; ...@@ -15,6 +15,7 @@ import com.mortals.xhx.protocol.complex.matter.model.req.ImplementationReq;
import com.mortals.xhx.protocol.complex.matter.model.rsp.AcceptRspInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.AcceptRspInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.LoginRspInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.LoginRspInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.MatterListInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.MatterListInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.implement.ImplementDetailInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.matter.MatterWorkInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.matter.MatterWorkInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.work.WorkInfo; import com.mortals.xhx.protocol.complex.matter.model.rsp.work.WorkInfo;
import com.mortals.xhx.protocol.complex.matter.service.IComplexMatterService; import com.mortals.xhx.protocol.complex.matter.service.IComplexMatterService;
...@@ -159,6 +160,21 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements ...@@ -159,6 +160,21 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
return Rest.fail(complexApiRest.getMessage()); return Rest.fail(complexApiRest.getMessage());
} }
@Override
public Rest<ImplementDetailInfo> getImplement(String deviceLogo, String eventId) {
String implementDetailApi = host + "event-implementation/get-by-id/" + eventId;
String rest = HttpUtil.createGet(implementDetailApi)
.execute().body();
log.info("implementDetailApi resp:{}", rest);
ComplexApiRest<ImplementDetailInfo> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<ImplementDetailInfo>>() {
});
if (complexApiRest.getCode() == 200) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult());
}
return Rest.fail(complexApiRest.getMessage());
}
private String checkToken(String deviceLogo) { private String checkToken(String deviceLogo) {
String deviceToken = tokenMap.getOrDefault(deviceLogo, ""); String deviceToken = tokenMap.getOrDefault(deviceLogo, "");
......
package com.mortals.xhx.thread;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.protocol.complex.matter.model.req.ImplementationReq;
import com.mortals.xhx.protocol.complex.matter.model.rsp.MatterListInfo;
import com.mortals.xhx.protocol.complex.matter.service.IComplexMatterService;
import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import static com.mortals.xhx.common.key.Constant.REDIS_RESP_TIMEOUT;
import static com.mortals.xhx.common.key.RedisKey.KEY_EVENT_IMPLEMENTATION_RESP;
@Slf4j
public class ImplementListSendTask implements Runnable {
private ImplementationReq implementationReq;
private String deviceLogo;
private IComplexMatterService complexMatterService;
private ICacheService cacheService;
public ImplementListSendTask(String deviceLogo, ImplementationReq implementationReq) {
this.implementationReq = implementationReq;
this.deviceLogo = deviceLogo;
complexMatterService = SpringUtils.getBean(IComplexMatterService.class);
cacheService = SpringUtils.getBean(ICacheService.class);
}
@Override
public void run() {
try {
log.info("启动发送");
Rest<MatterListInfo> rest = complexMatterService.findMatters(deviceLogo, implementationReq);
log.info("发送完成==>{}", JSONObject.toJSONString(rest));
cacheService.lpushForTime(KEY_EVENT_IMPLEMENTATION_RESP + implementationReq.getNonce(), REDIS_RESP_TIMEOUT, JSONObject.toJSONString(rest));
} catch (Exception e) {
log.error("发送异常:" + e);
}
}
}
\ No newline at end of file
...@@ -44,26 +44,23 @@ public class SendThread extends AbstractThread { ...@@ -44,26 +44,23 @@ public class SendThread extends AbstractThread {
@Override @Override
protected void process() throws Exception { protected void process() throws Exception {
// log.info("send thread process"); // log.info("send thread process");
String reqStr = cacheService.lpop(KEY_COMPLEX_REQ, String.class); String reqStr = cacheService.lpop(KEY_COMPLEX_REQ, String.class);
if (!ObjectUtils.isEmpty(reqStr)) { if (!ObjectUtils.isEmpty(reqStr)) {
JSONObject reqJson = JSONObject.parseObject(reqStr); JSONObject reqJson = JSONObject.parseObject(reqStr);
String urlPath = reqJson.getString("urlPath"); String urlPath = reqJson.getString("urlPath");
String timestamp = reqJson.getString("timestamp"); //根据url路由断言匹配发送 后续通过动态路由分发
//根据url路由断言匹配发送
if ("eventImplementation/list".equals(urlPath)) { if ("eventImplementation/list".equals(urlPath)) {
//查询事项 //查询事项
ImplementationReq implementationReq = JSONObject.parseObject(reqStr, ImplementationReq.class); ImplementationReq implementationReq = JSONObject.parseObject(reqStr, ImplementationReq.class);
ImplementListSendTask implementListSendTask = new ImplementListSendTask(deviceCode, implementationReq); ImplementListSendTask implementListSendTask = new ImplementListSendTask(deviceCode, implementationReq);
ThreadPool.getInstance().execute(implementListSendTask); ThreadPool.getInstance().execute(implementListSendTask);
} }else if("".equals(urlPath)){
}
} }
} }
...@@ -72,46 +69,6 @@ public class SendThread extends AbstractThread { ...@@ -72,46 +69,6 @@ public class SendThread extends AbstractThread {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
/**
* 事项列表执行发送任务
*
* @author zxfei
*/
class ImplementListSendTask implements Runnable {
private ImplementationReq implementationReq;
private String deviceLogo;
private IComplexMatterService complexMatterService;
private ICacheService cacheService;
public ImplementListSendTask(String deviceLogo, ImplementationReq implementationReq) {
this.implementationReq = implementationReq;
this.deviceLogo = deviceLogo;
complexMatterService = SpringUtils.getBean(IComplexMatterService.class);
cacheService = SpringUtils.getBean(ICacheService.class);
}
@Override
public void run() {
try {
log.info("启动发送");
Rest<MatterListInfo> rest = complexMatterService.findMatters(deviceLogo, implementationReq);
log.info("发送完成==>{}", JSONObject.toJSONString(rest));
cacheService.lpushForTime(KEY_EVENT_IMPLEMENTATION_RESP + implementationReq.getNonce(),60,JSONObject.toJSONString(rest));
} catch (Exception e) {
log.error("发送异常:" + e);
}
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment