This commit is contained in:
张良(004796)
2024-02-19 10:05:59 +08:00
parent 3f2f052780
commit 3e57df53c4

View File

@@ -1,10 +1,14 @@
package com.bashi.dk.service.impl; package com.bashi.dk.service.impl;
import com.aliyun.oss.ServiceException;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bashi.common.core.domain.entity.Customer; import com.bashi.common.core.domain.entity.Customer;
import com.bashi.common.exception.CustomException;
import com.bashi.dk.domain.Borrow;
import com.bashi.dk.domain.CustomerInfo; import com.bashi.dk.domain.CustomerInfo;
import com.bashi.dk.mapper.CustomerInfoMapper; import com.bashi.dk.mapper.CustomerInfoMapper;
import com.bashi.dk.service.BorrowService;
import com.bashi.dk.service.CustomerInfoService; import com.bashi.dk.service.CustomerInfoService;
import com.bashi.dk.service.CustomerService; import com.bashi.dk.service.CustomerService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -15,9 +19,15 @@ import org.springframework.stereotype.Service;
public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, CustomerInfo> implements CustomerInfoService { public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, CustomerInfo> implements CustomerInfoService {
@Autowired @Autowired
private CustomerService customerService; private CustomerService customerService;
@Autowired
private BorrowService borrowService;
@Override @Override
public void updateCustomerInfo(CustomerInfo customerInfo) { public void updateCustomerInfo(CustomerInfo customerInfo) {
Long customerId = customerInfo.getCustomerId(); Long customerId = customerInfo.getCustomerId();
long count = borrowService.count(Wrappers.lambdaQuery(Borrow.class).eq(Borrow::getCustomerId, customerId));
if(count > 0){
throw new CustomException("贷款已提交无法修改信息,请联系客服");
}
this.update(customerInfo,Wrappers.lambdaQuery(CustomerInfo.class) this.update(customerInfo,Wrappers.lambdaQuery(CustomerInfo.class)
.eq(CustomerInfo::getCustomerId, customerId)); .eq(CustomerInfo::getCustomerId, customerId));
CustomerInfo one = this.getOne(Wrappers.lambdaQuery(CustomerInfo.class) CustomerInfo one = this.getOne(Wrappers.lambdaQuery(CustomerInfo.class)