src/main/java/com/nathan/crm/service/CustomerLossService.java

(完整代码) 1KB

package com.nathan.crm.service;

import com.nathan.base.BaseService;
import com.nathan.crm.dao.CustomerLossMapper;
import com.nathan.crm.utils.AssertUtil;
import com.nathan.crm.vo.CustomerLoss;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class CustomerLossService extends BaseService<CustomerLoss,Integer> {

    @Resource
    private CustomerLossMapper customerLossMapper;

    /**
     * 修改流失客户state为1,表示确定为不可挽回的客户
     * @param id
     * @param lossReason
     */
    @Transactional
    public void updateCustomerLossStateById(Integer id, String lossReason) {
        /* 参数校验 */
        AssertUtil.isTrue(id == null,"客户不存在!");
        AssertUtil.isTrue(StringUtils.isBlank(lossReason),"请输入流失原因!");

        // 根据id获取流失客户信息
        CustomerLoss customerLoss = customerLossMapper.selectByPrimaryKey(id);
        // 设置值 state=1(确认流失)
        customerLoss.setState(1);
        customerLoss.setLossReason(lossReason);
        customerLoss.setConfirmLossTime(new Date());

        /* 执行更新操作 */
        AssertUtil.isTrue(customerLossMapper.updateByPrimaryKeySelective(customerLoss) != 1,"更新失败!");
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。