|
@ -20,15 +20,20 @@ package com.epmet.service.impl; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
|
|
import com.epmet.constant.UserConstant; |
|
|
import com.epmet.dao.CustomerStaffDao; |
|
|
import com.epmet.dao.CustomerStaffDao; |
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
import com.epmet.entity.CustomerStaffEntity; |
|
|
import com.epmet.entity.CustomerStaffEntity; |
|
|
import com.epmet.redis.CustomerStaffRedis; |
|
|
import com.epmet.redis.CustomerStaffRedis; |
|
|
import com.epmet.service.CustomerStaffService; |
|
|
import com.epmet.service.CustomerStaffService; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
@ -45,7 +50,7 @@ import java.util.Map; |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, CustomerStaffEntity> implements CustomerStaffService { |
|
|
public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, CustomerStaffEntity> implements CustomerStaffService { |
|
|
|
|
|
private Logger logger = LogManager.getLogger(getClass()); |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CustomerStaffRedis customerStaffRedis; |
|
|
private CustomerStaffRedis customerStaffRedis; |
|
|
|
|
|
|
|
@ -101,4 +106,23 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result getCustsomerStaffByPhone(String phone) { |
|
|
|
|
|
//判断用户是否存在
|
|
|
|
|
|
QueryWrapper<CustomerStaffEntity> wrapper = new QueryWrapper<>(); |
|
|
|
|
|
wrapper.eq(StringUtils.isNotBlank(phone), FieldConstant.MOBILE, phone); |
|
|
|
|
|
List<CustomerStaffEntity> customerStaffEntityList = baseDao.selectList(wrapper); |
|
|
|
|
|
if (null == customerStaffEntityList || customerStaffEntityList.size() == 0) { |
|
|
|
|
|
logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]",phone,EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(),EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg())); |
|
|
|
|
|
return new Result().error(EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
//判断用户是否已被禁用
|
|
|
|
|
|
CustomerStaffEntity customerStaff = customerStaffEntityList.get(0); |
|
|
|
|
|
if (UserConstant.DISABLED.equals(customerStaff.getEnableFlag())) { |
|
|
|
|
|
logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]",phone,EpmetErrorCode.GOV_STAFF_DISABLED.getCode(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg())); |
|
|
|
|
|
return new Result().error(EpmetErrorCode.GOV_STAFF_DISABLED.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
return new Result(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |