diff --git a/bweb/src/main/java/com/bweb/controller/BsAgentMerController.java b/bweb/src/main/java/com/bweb/controller/BsAgentMerController.java index bf40ada..a31e5ed 100644 --- a/bweb/src/main/java/com/bweb/controller/BsAgentMerController.java +++ b/bweb/src/main/java/com/bweb/controller/BsAgentMerController.java @@ -63,6 +63,7 @@ public class BsAgentMerController { return ResponseMsgUtil.exception(e); } } + @RequestMapping(value = "/unbindAgent", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "解绑代理商") diff --git a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java index 6f96ee7..0a1599b 100644 --- a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java @@ -20,6 +20,7 @@ import com.hfkj.service.gas.BsGasService; import com.hfkj.service.merchant.BsMerchantService; import com.hfkj.sysenum.agent.AgentTypeEnum; import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum; +import com.hfkj.sysenum.merchant.MerchantStatusEnum; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -166,6 +167,38 @@ public class BsAgentMerServiceImpl implements BsAgentMerService { } } } + + if (agent.getType().equals(AgentTypeEnum.type2.getCode())) { + // 通知 + BsAgentApiParam apiParam = agentApiParamService.getParam(agentId); + if (apiParam != null && StringUtils.isNotBlank(apiParam.getMerInfoNotify())) { + // 创建一个单线程的线程池 + ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(); + // 异步记录登录信息 + singleThreadExecutor.submit(new Runnable() { + @Override + public void run() { + try { + for (String merNo : merNoArray) { + try { + // 查询油站 + ResponseQueryGasInfoModel gasInfo = apiGasService.queryGasInfo(merNo); + gasInfo.setGasStatus(MerchantStatusEnum.status2.getNumber()); + JSONObject notifyParam = JSONObject.parseObject(JSONObject.toJSONString(gasInfo), JSONObject.class); + notifyParam.put("sign", SignatureUtil.createSign(notifyParam, apiParam.getAppSecret())); + // 通知代理提供的URL + HttpsUtils.doApiPost(apiParam.getMerInfoNotify(), notifyParam); + } catch (Exception e) { + System.out.println("通知代理商:"+apiParam.getAgentId()+"失败"+e.getMessage()); + } + } + } catch (Exception e) { + System.out.println("通知代理商:"+apiParam.getAgentId()+"失败"+e.getMessage()); + } + } + }); + } + } } @Override