|
@@ -6,10 +6,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fire.admin.dto.CustomerDto;
|
|
|
import com.fire.admin.mapper.CustomerMapper;
|
|
|
import com.fire.admin.service.CustomerService;
|
|
|
+import com.fire.admin.util.SecurityUtil;
|
|
|
import com.fire.admin.vo.CustomerInfoVo;
|
|
|
import com.fire.dto.CustomerInfo;
|
|
|
+import com.fire.utils.date.DateUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import redis.clients.jedis.JedisCluster;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+
|
|
|
+import static com.fire.dto.enums.RedisKey.CUSTOMER_AMOUNT;
|
|
|
|
|
|
/**
|
|
|
* @author: liuliu
|
|
@@ -21,6 +29,9 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, CustomerInfo> implements CustomerService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private JedisCluster jedisCluster;
|
|
|
+
|
|
|
/**
|
|
|
* @Description: TODO 分页获取客户信息
|
|
|
* @Param: 查询条件,根据客户名称模糊查询
|
|
@@ -29,7 +40,41 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, CustomerInf
|
|
|
* @Date: 2021/5/20 16:25
|
|
|
*/
|
|
|
@Override
|
|
|
- public IPage<CustomerInfoVo> getcustomerInfoPage(Page page, CustomerDto customerDto) {
|
|
|
+ public IPage<CustomerInfoVo> getCustomerInfoPage(Page page, CustomerDto customerDto) {
|
|
|
return baseMapper.queryCustomerInfoPage(page, customerDto);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: TODO 新增客户信息
|
|
|
+ * @Param: [customerDto]
|
|
|
+ * @return: void
|
|
|
+ * @Author: liuliu
|
|
|
+ * @Date: 2021/5/21 15:14
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void insertCustomer(CustomerDto customerDto) {
|
|
|
+ CustomerInfo customerInfo = CustomerInfo.builder().partnerId(customerDto.getPartnerId())
|
|
|
+ .customerName(customerDto.getCustomerName())
|
|
|
+ .shorterName(customerDto.getShorterName())
|
|
|
+ .linkmanName(customerDto.getLinkmanName())
|
|
|
+ .linkmanMobile(customerDto.getLinkmanMobile())
|
|
|
+ .linkmanEmail(customerDto.getLinkmanEmail())
|
|
|
+ .address(customerDto.getAddress())
|
|
|
+ .status(1)
|
|
|
+ .isFirstLogin(0)
|
|
|
+ .isDeleted(0)
|
|
|
+ // .creator(SecurityUtil.getUser().getUsername())
|
|
|
+ .creator("唐僧")
|
|
|
+ .createTime(DateUtils.strformatDatetime(LocalDateTime.now()))
|
|
|
+ .partnerCommission(customerDto.getPartnerCommission())
|
|
|
+ .userId(customerDto.getUserId())
|
|
|
+ .priceCheck(customerDto.getPriceCheck()).build();
|
|
|
+ baseMapper.insert(customerInfo);
|
|
|
+
|
|
|
+ log.info("新增客户对象为:【{}】", customerInfo.toString());
|
|
|
+
|
|
|
+ jedisCluster.hset(CUSTOMER_AMOUNT.key(), CUSTOMER_AMOUNT.key().concat(customerInfo.getCustomerId().toString()), "0");
|
|
|
+
|
|
|
+ }
|
|
|
}
|