Commit b14c1383 authored by huangcb's avatar huangcb

承运商接口:停用司机帐号时,通知APP后台

parent 871a6a22
......@@ -45,7 +45,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
......@@ -82,7 +81,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
......
package com.esv.freight.customer.feign;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.feign.FeignAppService
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 17:56
* @version:1.0
*/
@FeignClient(value = "freight-app-service")
public interface FeignAppService {
/**
* description 停用司机帐号
* param [bodyJson]
* return com.alibaba.fastjson.JSONObject
* author Administrator
* createTime 2020/05/06 14:35
**/
@PostMapping(value = "/app/driverBackend/account/stop")
JSONObject blockDriverAccount(JSONObject bodyJson);
}
......@@ -16,6 +16,13 @@ import org.springframework.web.bind.annotation.PostMapping;
@FeignClient(value = "freight-base-service")
public interface FeignBaseService {
/**
* description 生成编号
* param [bodyJson]
* return com.alibaba.fastjson.JSONObject
* author Administrator
* createTime 2020/05/06 14:36
**/
@PostMapping(value = "/base/batchId/generate")
JSONObject getBatchId(JSONObject bodyJson);
}
package com.esv.freight.customer.module.driver.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -10,6 +11,7 @@ import com.esv.freight.customer.common.component.PasswordComponent;
import com.esv.freight.customer.common.exception.EException;
import com.esv.freight.customer.common.util.ReqUtils;
import com.esv.freight.customer.common.vo.PageResultVO;
import com.esv.freight.customer.feign.FeignAppService;
import com.esv.freight.customer.module.carrier.CarrierConstants;
import com.esv.freight.customer.module.carrier.entity.CarrierAccountEntity;
import com.esv.freight.customer.module.carrier.service.CarrierAccountService;
......@@ -26,6 +28,7 @@ import com.esv.freight.customer.module.driver.service.DriverAccountService;
import com.esv.freight.customer.module.driver.service.DriverAuditHistoryService;
import com.esv.freight.customer.module.driver.service.DriverInfoService;
import com.esv.freight.customer.module.driver.vo.DriverListVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -37,6 +40,7 @@ import java.util.List;
@Service("driverAccountService")
@Slf4j
public class DriverAccountServiceImpl extends ServiceImpl<DriverAccountDao, DriverAccountEntity> implements DriverAccountService {
private ErrorMessageComponent errorMessageComponent;
......@@ -49,15 +53,18 @@ public class DriverAccountServiceImpl extends ServiceImpl<DriverAccountDao, Driv
private CarrierAccountService carrierAccountService;
private FeignAppService feignAppService;
@Autowired
public DriverAccountServiceImpl(ErrorMessageComponent errorMessageComponent, PasswordComponent passwordComponent,
DriverInfoService driverInfoService, DriverAuditHistoryService driverAuditHistoryService,
CarrierAccountService carrierAccountService) {
CarrierAccountService carrierAccountService, FeignAppService feignAppService) {
this.errorMessageComponent = errorMessageComponent;
this.passwordComponent = passwordComponent;
this.driverInfoService = driverInfoService;
this.driverAuditHistoryService = driverAuditHistoryService;
this.carrierAccountService = carrierAccountService;
this.feignAppService = feignAppService;
}
@Override
......@@ -232,7 +239,19 @@ public class DriverAccountServiceImpl extends ServiceImpl<DriverAccountDao, Driv
DriverAccountEntity driverAccountEntity = new DriverAccountEntity();
driverAccountEntity.setId(id);
driverAccountEntity.setAccountStatus(DriverConstants.ACCOUNT_STATUS_BLOCK);
return this.baseMapper.updateById(driverAccountEntity);
int flag = this.baseMapper.updateById(driverAccountEntity);
// 4:通知APP后台
JSONObject bodyJson = new JSONObject();
bodyJson.put("phone", accountEntity.getAccount());
try {
JSONObject resultJson = feignAppService.blockDriverAccount(bodyJson);
log.info("停用帐号Feign通知APP后台响应结果:{}", resultJson.toJSONString());
} catch (Exception e) {
log.error("停用帐号Feign通知APP后台发生错误:" + e.getMessage(), e);
}
return flag;
}
@Override
......
......@@ -44,7 +44,7 @@ mybatis-plus:
ribbon:
eager-load:
enabled: true
clients: freight-base-service
clients: freight-base-service,freight-app-service
error-message:
goodsowner:
account:
......
......@@ -44,7 +44,7 @@ mybatis-plus:
ribbon:
eager-load:
enabled: true
clients: freight-base-service
clients: freight-base-service,freight-app-service
error-message:
goodsowner:
account:
......
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