提交代码

master
胡锐 1 month ago
parent 1bc3d2c899
commit 96acc211bf
  1. 1
      bweb/src/main/java/com/bweb/controller/BsAgentMerController.java
  2. 33
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java

@ -63,6 +63,7 @@ public class BsAgentMerController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/unbindAgent", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "解绑代理商")

@ -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

Loading…
Cancel
Save