Commit 44e1167d authored by 赵啸非's avatar 赵啸非

添加事项材料与情形查询

parent 07c2c7bf
......@@ -3,6 +3,8 @@ package com.mortals.xhx.busiz.req;
import com.mortals.xhx.busiz.BaseApiReq;
import lombok.Data;
import java.util.List;
/**
* 事项查询
*
......@@ -18,5 +20,11 @@ public class ComplexImplementationReq extends BaseApiReq {
private String implementName;
private String eventId;
private List<String> itemsIds;
}
package com.mortals.xhx.busiz.rsp.implement;
import lombok.Data;
@Data
public class ComplexImplementDetailInfo{
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
package com.mortals.xhx.busiz.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.busiz.rsp.material;
import java.util.List;
import lombok.Data;
@Data
public class ComplexMaterialInfo{
private Object isPaper;
private String materialDefineId;
private Integer materialTypeId;
private Object materialPath;
private String acceptanceCtiteria;
private String highCameraNoBasisExplain;
private List<PointsItem> points;
private Object implementName;
private Object materialForm;
private String goRepeatId;
private String updateBy;
private Object notation;
private Object materialExampleInstances;
private String fillNotice;
private String channelId;
private Object materialApprovalResult;
private Object formId;
private String eventId;
private Object materialPaths;
private String sampleTableUrl;
private String channelExplain;
private String highCameraIsBasis;
private String deptId;
private Integer paperCopies;
private String updateTime;
private String materialId;
private Integer fromId;
private String materialName;
private String createBy;
private Object examples;
private String paperSpecifications;
private String createTime;
private String ythId;
private Object mrpIds;
private List<Object> regulations;
private Boolean hasForm;
private String blankFormUrl;
private Object resultsId;
private String necessity;
private String remarks;
private Object isPointsAll;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp.material;
import lombok.Data;
@Data
public class PointsItem{
private Object mrpOrder;
private String mrpId;
private String businessTacheId;
private String mrpDetails;
private String state;
private String stateDate;
private String materialId;
private Integer userId;
private Object businessTacheCode;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp.situation;
import java.util.List;
import lombok.Data;
@Data
public class ChildrenItem{
private String situationItemId;
private List<MaterialsItem> materials;
private String situationDefineId;
private String situationItemName;
private String label;
private String id;
private String situationItemType;
private String type;
private String parentId;
private String key;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp.situation;
import java.util.List;
import lombok.Data;
@Data
public class ComplexStituationInfo{
private List<ChildrenItem> children;
private String name;
private String id;
private String label;
private String type;
private String key;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp.situation;
import lombok.Data;
@Data
public class MaterialsItem{
private String name;
private String pid;
private Integer paperCopies;
private String id;
private String label;
private String type;
private String fromId;
private String parentId;
private String key;
}
\ No newline at end of file
......@@ -15,6 +15,9 @@ import com.mortals.xhx.busiz.req.ComplexImplementationReq;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.busiz.rsp.ComplexApiResp;
import com.mortals.xhx.busiz.rsp.ImplementEventInfo;
import com.mortals.xhx.busiz.rsp.implement.ComplexImplementDetailInfo;
import com.mortals.xhx.busiz.rsp.material.ComplexMaterialInfo;
import com.mortals.xhx.busiz.rsp.situation.ComplexStituationInfo;
import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.protocol.complex.ComplexApiRest;
import com.mortals.xhx.protocol.complex.matter.model.rsp.MatterListInfo;
......@@ -25,6 +28,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static com.mortals.xhx.common.key.Constant.HTTP_TIMEOUT;
import static com.mortals.xhx.common.key.RedisKey.*;
......@@ -57,21 +62,143 @@ public class ComplexApiController {
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try {
//加入请求发送队列,并且阻塞获取异步线程结果
req.setNonce(RandomUtil.randomNumbers(6));
//将请求加入队列
cacheService.lpush(KEY_COMPLEX_REQ, JSONObject.toJSONString(req));
//获取异步响应结果
String rest = cacheService.blpop(KEY_EVENT_IMPLEMENTATION_RESP + req.getNonce(), HTTP_TIMEOUT, String.class);
//String rest ="";
if (ObjectUtil.isEmpty(rest)) {
throw new AppException("请求访问超时");
}
Rest<ImplementEventInfo> eventListRest = JSON.parseObject(rest, new TypeReference<Rest<ImplementEventInfo>>() {
});
return JSON.toJSONString(eventListRest);
} catch (Exception e) {
log.error("接收数据失败", e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
}
}
/**
* 事项详细查询
*
* @param req
* @return
*/
@PostMapping("event-implementation/get-by-id")
@UnAuth
public String implementationGetById(@RequestBody ComplexImplementationReq req) {
log.info("【事项详细查询】【请求体】--> " + JSONObject.toJSONString(req));
req.setUrlPath("event-implementation/get-by-id");
ApiResp<String> rsp = new ApiResp<>();
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try {
req.setNonce(RandomUtil.randomNumbers(6));
cacheService.lpush(KEY_COMPLEX_REQ, JSONObject.toJSONString(req));
String rest = cacheService.blpop(KEY_EVENT_IMPLEMENTATION_RESP + req.getNonce(), HTTP_TIMEOUT, String.class);
if (ObjectUtil.isEmpty(rest)) {
throw new AppException("请求访问超时");
}
Rest<ComplexImplementDetailInfo> eventRest = JSON.parseObject(rest, new TypeReference<Rest<ComplexImplementDetailInfo>>() {
});
return JSON.toJSONString(eventRest);
} catch (Exception e) {
log.error("接收数据失败", e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
}
}
/**
* 查询办理事项情形
*
* @param req
* @return
*/
@PostMapping("bus-situation-material/getSituationMaterialTreeByEventIds")
@UnAuth
public String getSituationMaterialTreeByEventIds(@RequestBody ComplexImplementationReq req) {
log.info("【查询办理事项情形】【请求体】--> " + JSONObject.toJSONString(req));
req.setUrlPath("bus-situation-material/getSituationMaterialTreeByEventIds");
ApiResp<String> rsp = new ApiResp<>();
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try {
req.setNonce(RandomUtil.randomNumbers(6));
cacheService.lpush(KEY_COMPLEX_REQ, JSONObject.toJSONString(req));
String rest = cacheService.blpop(KEY_EVENT_IMPLEMENTATION_RESP + req.getNonce(), HTTP_TIMEOUT, String.class);
if (ObjectUtil.isEmpty(rest)) {
throw new AppException("请求访问超时");
}
Rest<ComplexStituationInfo> eventRest = JSON.parseObject(rest, new TypeReference<Rest<ComplexStituationInfo>>() {
});
return JSON.toJSONString(eventRest);
} catch (Exception e) {
log.error("接收数据失败", e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
}
}
/**
* 根据事项与情形查询办理事项材料
*
* @param req
* @return
*/
@PostMapping("consulting-service/getMaterialByEventAndSituation")
@UnAuth
public String getMaterialByEventAndSituation(@RequestBody ComplexImplementationReq req) {
log.info("【根据事项与情形查询办理事项材料】【请求体】--> " + JSONObject.toJSONString(req));
req.setUrlPath("consulting-service/getMaterialByEventAndSituation");
ApiResp<String> rsp = new ApiResp<>();
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try {
req.setNonce(RandomUtil.randomNumbers(6));
cacheService.lpush(KEY_COMPLEX_REQ, JSONObject.toJSONString(req));
String rest = cacheService.blpop(KEY_EVENT_IMPLEMENTATION_RESP + req.getNonce(), HTTP_TIMEOUT, String.class);
if (ObjectUtil.isEmpty(rest)) {
throw new AppException("请求访问超时");
}
Rest<List<ComplexMaterialInfo>> eventRest = JSON.parseObject(rest, new TypeReference<Rest<List<ComplexMaterialInfo>>>() {
});
return JSON.toJSONString(eventRest);
} catch (Exception e) {
log.error("接收数据失败", e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
}
}
/**
* 根据事项查询办理事项材料
*
* @param req
* @return
*/
@PostMapping("material/findList")
@UnAuth
public String materialFindList(@RequestBody ComplexImplementationReq req) {
log.info("【根据事项查询办理事项材料】【请求体】--> " + JSONObject.toJSONString(req));
req.setUrlPath("material/findList");
ApiResp<String> rsp = new ApiResp<>();
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try {
req.setNonce(RandomUtil.randomNumbers(6));
cacheService.lpush(KEY_COMPLEX_REQ, JSONObject.toJSONString(req));
String rest = cacheService.blpop(KEY_EVENT_IMPLEMENTATION_RESP + req.getNonce(), HTTP_TIMEOUT, String.class);
if (ObjectUtil.isEmpty(rest)) {
throw new AppException("请求访问超时");
}
Rest<ComplexMaterialInfo> eventRest = JSON.parseObject(rest, new TypeReference<Rest<ComplexMaterialInfo>>() {
});
return JSON.toJSONString(eventRest);
} catch (Exception e) {
log.error("接收数据失败", e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
......
......@@ -12,7 +12,7 @@ public class RedisKey {
/**
* 事件异步响应队列
* 事件列表异步响应队列
*/
public static final String KEY_EVENT_IMPLEMENTATION_RESP = "complex:event:implementation:resp:";
......
......@@ -3,9 +3,16 @@ package com.mortals.xhx.protocol.complex.matter.model.req;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class BaseReq implements Serializable {
private String nonce;
private String eventId;
private String eventIds;
private List<String> itemsIds;
}
package com.mortals.xhx.protocol.complex.matter.model.rsp.material;
import java.util.List;
import lombok.Data;
@Data
public class MaterialInfo{
private Object isPaper;
private String materialDefineId;
private Integer materialTypeId;
private Object materialPath;
private String acceptanceCtiteria;
private String highCameraNoBasisExplain;
private List<PointsItem> points;
private Object implementName;
private Object materialForm;
private String goRepeatId;
private String updateBy;
private Object notation;
private Object materialExampleInstances;
private String fillNotice;
private String channelId;
private Object materialApprovalResult;
private Object formId;
private String eventId;
private Object materialPaths;
private String sampleTableUrl;
private String channelExplain;
private String highCameraIsBasis;
private String deptId;
private Integer paperCopies;
private String updateTime;
private String materialId;
private Integer fromId;
private String materialName;
private String createBy;
private Object examples;
private String paperSpecifications;
private String createTime;
private String ythId;
private Object mrpIds;
private List<Object> regulations;
private Boolean hasForm;
private String blankFormUrl;
private Object resultsId;
private String necessity;
private String remarks;
private Object isPointsAll;
}
\ No newline at end of file
package com.mortals.xhx.protocol.complex.matter.model.rsp.material;
import lombok.Data;
@Data
public class PointsItem{
private Object mrpOrder;
private String mrpId;
private String businessTacheId;
private String mrpDetails;
private String state;
private String stateDate;
private String materialId;
private Integer userId;
private Object businessTacheCode;
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ 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.MatterListInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.implement.ImplementDetailInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.material.MaterialInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.matter.MatterWorkInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.work.WorkInfo;
......@@ -58,6 +59,30 @@ public interface IComplexMatterService extends IComplexService {
Rest<MatterListInfo> findMatters(String deviceLogo, ImplementationReq implementationReq);
/**
* 查询事项所需材料根据事项与情形id
*
* @param deviceLogo
* @param implementationReq
* @return
*/
Rest<List<MaterialInfo>> getMaterialByEventAndSituation(String deviceLogo, ImplementationReq implementationReq);
/**
* 查询事项所需材料
*
* @param deviceLogo
* @param eventId
* @return
*/
Rest<List<MaterialInfo>> getMaterialByEvent(String deviceLogo, String eventId);
/**
* 查询办理事项情形
*
......
......@@ -5,6 +5,7 @@ import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.protocol.complex.AbstractComplexService;
......@@ -16,6 +17,7 @@ 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.MatterListInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.implement.ImplementDetailInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.material.MaterialInfo;
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.service.IComplexMatterService;
......@@ -47,7 +49,7 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
log.info("deviceLoginApi resp:{}", rest);
ComplexApiRest<LoginRspInfo> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<LoginRspInfo>>() {
});
if (complexApiRest.getCode() == 200) {
if (complexApiRest.getSuccess()) {
//更新token
String deviceLoginToken = complexApiRest.getResult().getToken();
String deviceLogo = complexApiRest.getResult().getSelfDeviceInfo().getDeviceLogo();
......@@ -59,7 +61,6 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
@Override
public Rest<String> uploadFile(String deviceLogo, byte[] bytes, String fileName) {
String uploadApi = host + "common/uploadFileToFtp?conversionImage=Y";
HttpRequest request = HttpRequest.post(uploadApi);
String deviceToken = checkToken(deviceLogo);
......@@ -68,7 +69,7 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
log.info("uploadApi resp:{}", uploadRest);
ComplexApiRest<String> complexApiRest = JSON.parseObject(uploadRest, new TypeReference<ComplexApiRest<String>>() {
});
if (complexApiRest.getCode() == 200) {
if (complexApiRest.getSuccess()) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult());
}
return Rest.fail(complexApiRest.getMessage());
......@@ -86,7 +87,7 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
log.info("accept resp==>{}", rest);
ComplexApiRest<List<AcceptRspInfo>> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<List<AcceptRspInfo>>>() {
});
if (complexApiRest.getCode() == 200) {
if (complexApiRest.getSuccess()) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult());
}
return Rest.fail(complexApiRest.getMessage());
......@@ -112,7 +113,27 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
log.info("complexApiRest resp:{}", rest);
ComplexApiRest<MatterListInfo> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<MatterListInfo>>() {
});
if (complexApiRest.getCode() == 200) {
if (complexApiRest.getSuccess()) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult());
}
return Rest.fail(complexApiRest.getMessage());
}
@Override
public Rest<List<MaterialInfo>> getMaterialByEvent(String deviceLogo, String eventId) {
String mattersApi = host + "material/findList";
Map<String, String> paramMap = new HashMap<>();
paramMap.put("eventId", eventId);
String deviceToken = checkToken(deviceLogo);
String rest = HttpUtil.createGet(mattersApi)
.header("X-Access-Token", deviceToken)
.formStr(paramMap)
.execute().body();
log.info("mattersApi resp:{}", rest);
ComplexApiRest<List<MaterialInfo>> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<List<MaterialInfo>>>() {
});
if (complexApiRest.getSuccess()) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult());
}
return Rest.fail(complexApiRest.getMessage());
......@@ -131,7 +152,7 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
log.info("mattersApi resp:{}", rest);
ComplexApiRest<List<MatterWorkInfo>> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<List<MatterWorkInfo>>>() {
});
if (complexApiRest.getCode() == 200) {
if (complexApiRest.getSuccess()) {
if (!ObjectUtils.isEmpty(complexApiRest.getResult())) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult().get(0));
} else {
......@@ -154,7 +175,7 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
ComplexApiRest<WorkInfo> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<WorkInfo>>() {
});
log.info("getDynamicFormByEventIds resp:{}", rest);
if (complexApiRest.getCode() == 200) {
if (complexApiRest.getSuccess()) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult());
}
return Rest.fail(complexApiRest.getMessage());
......@@ -169,7 +190,30 @@ public class ComplexMatterServiceImpl extends AbstractComplexService implements
log.info("implementDetailApi resp:{}", rest);
ComplexApiRest<ImplementDetailInfo> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<ImplementDetailInfo>>() {
});
if (complexApiRest.getCode() == 200) {
if (complexApiRest.getSuccess()) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult());
}
return Rest.fail(complexApiRest.getMessage());
}
@Override
public Rest<List<MaterialInfo>> getMaterialByEventAndSituation(String deviceLogo, ImplementationReq implementationReq) {
String mattersApi = host + "consulting-service/getMaterialByEventAndSituation";
JSONObject jsonObject = new JSONObject();
jsonObject.put("eventId", implementationReq.getEventId());
jsonObject.put("itemsIds", implementationReq.getItemsIds());
String deviceToken = checkToken(deviceLogo);
String rest = HttpUtil.createPost(mattersApi)
.header("X-Access-Token", deviceToken)
.body(jsonObject.toJSONString())
.execute().body();
log.info("getMaterialByEventAndSituation resp==>{}", rest);
ComplexApiRest<List<MaterialInfo>> complexApiRest = JSON.parseObject(rest, new TypeReference<ComplexApiRest<List<MaterialInfo>>>() {
});
if (complexApiRest.getSuccess()) {
return Rest.ok(complexApiRest.getMessage(), complexApiRest.getResult());
}
return Rest.fail(complexApiRest.getMessage());
......
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.material.MaterialInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.matter.MatterWorkInfo;
import com.mortals.xhx.protocol.complex.matter.service.IComplexMatterService;
import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
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 EventAndSituationSendTask implements Runnable {
private ImplementationReq implementationReq;
private String deviceLogo;
private IComplexMatterService complexMatterService;
private ICacheService cacheService;
public EventAndSituationSendTask(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<List<MaterialInfo>> rest = complexMatterService.getMaterialByEventAndSituation(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
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.model.rsp.implement.ImplementDetailInfo;
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 ImplementDetailSendTask implements Runnable {
private ImplementationReq implementationReq;
private String deviceLogo;
private IComplexMatterService complexMatterService;
private ICacheService cacheService;
public ImplementDetailSendTask(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<ImplementDetailInfo> rest = complexMatterService.getImplement(deviceLogo, implementationReq.getEventId());
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
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.material.MaterialInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.matter.MatterWorkInfo;
import com.mortals.xhx.protocol.complex.matter.service.IComplexMatterService;
import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
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 ImplementMaterialSendTask implements Runnable {
private ImplementationReq implementationReq;
private String deviceLogo;
private IComplexMatterService complexMatterService;
private ICacheService cacheService;
public ImplementMaterialSendTask(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<List<MaterialInfo>> rest = complexMatterService.getMaterialByEvent(deviceLogo, implementationReq.getEventId());
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
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.implement.ImplementDetailInfo;
import com.mortals.xhx.protocol.complex.matter.model.rsp.matter.MatterWorkInfo;
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 ImplementSituationSendTask implements Runnable {
private ImplementationReq implementationReq;
private String deviceLogo;
private IComplexMatterService complexMatterService;
private ICacheService cacheService;
public ImplementSituationSendTask(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<MatterWorkInfo> rest = complexMatterService.doWorkMatterSearch(deviceLogo, implementationReq.getEventId());
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
......@@ -55,8 +55,22 @@ public class SendThread extends AbstractThread {
ImplementationReq implementationReq = JSONObject.parseObject(reqStr, ImplementationReq.class);
ImplementListSendTask implementListSendTask = new ImplementListSendTask(deviceCode, implementationReq);
ThreadPool.getInstance().execute(implementListSendTask);
}else if("".equals(urlPath)){
}else if("event-implementation/get-by-id".equals(urlPath)){
ImplementationReq implementationReq = JSONObject.parseObject(reqStr, ImplementationReq.class);
ImplementDetailSendTask implementSendTask = new ImplementDetailSendTask(deviceCode, implementationReq);
ThreadPool.getInstance().execute(implementSendTask);
}else if("bus-situation-material/getSituationMaterialTreeByEventIds".equals(urlPath)){
ImplementationReq implementationReq = JSONObject.parseObject(reqStr, ImplementationReq.class);
ImplementSituationSendTask implementSendTask = new ImplementSituationSendTask(deviceCode, implementationReq);
ThreadPool.getInstance().execute(implementSendTask);
}else if("consulting-service/getMaterialByEventAndSituation".equals(urlPath)){
ImplementationReq implementationReq = JSONObject.parseObject(reqStr, ImplementationReq.class);
EventAndSituationSendTask implementSendTask = new EventAndSituationSendTask(deviceCode, implementationReq);
ThreadPool.getInstance().execute(implementSendTask);
}else if("material/findList".equals(urlPath)){
ImplementationReq implementationReq = JSONObject.parseObject(reqStr, ImplementationReq.class);
ImplementMaterialSendTask implementSendTask = new ImplementMaterialSendTask(deviceCode, implementationReq);
ThreadPool.getInstance().execute(implementSendTask);
}
}
......
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