diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerBankController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerBankController.java index c2b3a23b..d6c65e12 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerBankController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerBankController.java @@ -7,6 +7,7 @@ import com.ghy.common.adapay.model.AdapayStatusEnum; import com.ghy.common.adapay.model.Merchant; import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.utils.AdapayUtils; +import com.ghy.common.utils.ExceptionUtil; import com.ghy.customer.domain.CustomerBank; import com.ghy.customer.request.BindBankCardRequest; import com.ghy.customer.service.CustomerBankService; @@ -85,6 +86,18 @@ public class CustomerBankController { } return AjaxResult.success(); } + + @PostMapping("getByCustomerId") + @ResponseBody + public AjaxResult getByCustomerId(@RequestBody BindBankCardRequest request){ + try { + return AjaxResult.success(customerBankService.selectByCustomerId(request.getCustomerId())); + }catch (Exception e){ + log.error(e.getMessage()); + return AjaxResult.error(ExceptionUtil.getExceptionMessage(e)); + } + } + } diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerBankController.java b/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerBankController.java index eaf2628d..377dfda0 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerBankController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerBankController.java @@ -8,6 +8,7 @@ import com.ghy.common.adapay.model.Merchant; import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.utils.AdapayUtils; +import com.ghy.common.utils.ExceptionUtil; import com.ghy.worker.domain.WorkerBank; import com.ghy.worker.request.WorkerBindBankCardRequest; import com.ghy.worker.service.WorkerBankService; @@ -89,5 +90,16 @@ public class WorkerBankController extends BaseController { return AjaxResult.success(); } + @PostMapping("/getByWorkerId") + @ResponseBody + public AjaxResult getByWorkerId(@RequestBody WorkerBindBankCardRequest request){ + try { + return AjaxResult.success(workerBankService.getByWorkerId(request.getWorkerId())); + }catch (Exception e){ + + return AjaxResult.error(ExceptionUtil.getExceptionMessage(e)); + } + } + } diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/CustomerBankService.java b/ghy-custom/src/main/java/com/ghy/customer/service/CustomerBankService.java index ec6dcf06..1261357a 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/CustomerBankService.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/CustomerBankService.java @@ -18,6 +18,13 @@ public interface CustomerBankService { */ List getCustomerBankList(CustomerBank customerBank); + /** + * 用消费者ID查银行卡信息 + * + * @param customerId 消费者ID + */ + CustomerBank selectByCustomerId(Long customerId); + /** * 用消费者ID和部门ID查银行卡信息 * diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerBankServiceImpl.java b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerBankServiceImpl.java index e17355f5..75d13786 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerBankServiceImpl.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerBankServiceImpl.java @@ -23,6 +23,15 @@ public class CustomerBankServiceImpl implements CustomerBankService { return customerBankMapper.getCustomerBankList(customerBank); } + @Override + public CustomerBank selectByCustomerId(Long customerId){ + List list = customerBankMapper.selectByCustomerId(customerId); + if(list.size()>0){ + return list.get(0); + } + return null; + } + @Override public List selectByCustomerIdAndDeptId(Long customerId, Long deptId) { return customerBankMapper.selectByCustomerIdAndDeptId(customerId, deptId); diff --git a/ghy-worker/src/main/java/com/ghy/worker/mapper/WorkerBankMapper.java b/ghy-worker/src/main/java/com/ghy/worker/mapper/WorkerBankMapper.java index b8dadc21..22772216 100644 --- a/ghy-worker/src/main/java/com/ghy/worker/mapper/WorkerBankMapper.java +++ b/ghy-worker/src/main/java/com/ghy/worker/mapper/WorkerBankMapper.java @@ -14,4 +14,10 @@ public interface WorkerBankMapper { */ int insertWorkerBank(WorkerBank workerBank); + /** + * @param workerId 师傅id + * @return 师傅银行卡对象 + */ + WorkerBank getByWorkerId(Long workerId); + } diff --git a/ghy-worker/src/main/java/com/ghy/worker/service/WorkerBankService.java b/ghy-worker/src/main/java/com/ghy/worker/service/WorkerBankService.java index 61582b10..2cff94cd 100644 --- a/ghy-worker/src/main/java/com/ghy/worker/service/WorkerBankService.java +++ b/ghy-worker/src/main/java/com/ghy/worker/service/WorkerBankService.java @@ -14,4 +14,10 @@ public interface WorkerBankService { */ int insertWorkerBank(WorkerBank workerBank); + /** + * @param workerId 师傅id + * @return 师傅银行卡对象 + */ + WorkerBank getByWorkerId(Long workerId); + } diff --git a/ghy-worker/src/main/java/com/ghy/worker/service/impl/WorkerBankServiceImpl.java b/ghy-worker/src/main/java/com/ghy/worker/service/impl/WorkerBankServiceImpl.java index 7d0e2f12..7eccc09d 100644 --- a/ghy-worker/src/main/java/com/ghy/worker/service/impl/WorkerBankServiceImpl.java +++ b/ghy-worker/src/main/java/com/ghy/worker/service/impl/WorkerBankServiceImpl.java @@ -19,4 +19,9 @@ public class WorkerBankServiceImpl implements WorkerBankService { public int insertWorkerBank(WorkerBank workerBank) { return workerBankMapper.insertWorkerBank(workerBank); } + + @Override + public WorkerBank getByWorkerId(Long workerId) { + return workerBankMapper.getByWorkerId(workerId); + } } diff --git a/ghy-worker/src/main/resources/mapper/worker/WorkerBankMapper.xml b/ghy-worker/src/main/resources/mapper/worker/WorkerBankMapper.xml index 7b850ee4..073eed1b 100644 --- a/ghy-worker/src/main/resources/mapper/worker/WorkerBankMapper.xml +++ b/ghy-worker/src/main/resources/mapper/worker/WorkerBankMapper.xml @@ -51,10 +51,15 @@ ) - - - - +