| | |
| | | import com.mzl.flower.entity.partner.Partner; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.mapper.partner.PartnerMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | private final CustomerMapper customerMapper; |
| | | |
| | | private final PartnerMapper partnerMapper; |
| | | |
| | | @Resource |
| | | private BaseService baseService; |
| | | |
| | | public CustomerService(CustomerMapper customerMapper, PartnerMapper partnerMapper) { |
| | | this.customerMapper = customerMapper; |
| | |
| | | } |
| | | |
| | | customer.create(SecurityUtils.getUserId()); |
| | | customer.setIsEnabled(true); |
| | | customerMapper.insert(customer); |
| | | } else {//重新修改 |
| | | customer = customerMapper.selectById(dto.getId()); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | public void isEnable(Long id) { |
| | | Customer customer = customerMapper.selectById(id); |
| | | if (customer == null) { |
| | | throw new ValidationException("商户信息不存在"); |
| | | } |
| | | if (customer.getIsEnabled()) { |
| | | customer.setIsEnabled(false); |
| | | //强制下线 |
| | | baseService.removeToken(customer.getUserId()); |
| | | } else { |
| | | customer.setIsEnabled(true); |
| | | } |
| | | customer.update(SecurityUtils.getUserId()); |
| | | customerMapper.updateById(customer); |
| | | } |
| | | } |