FollowUpServiceImp.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.goafanti.customer.service.impl;
  2. import java.lang.reflect.InvocationTargetException;
  3. import java.util.UUID;
  4. import org.apache.commons.beanutils.BeanUtils;
  5. import org.apache.commons.lang3.StringUtils;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import com.goafanti.common.dao.CustomerMapper;
  9. import com.goafanti.common.dao.CustomerUserInfoMapper;
  10. import com.goafanti.common.dao.FollowUpRecordMapper;
  11. import com.goafanti.common.model.Customer;
  12. import com.goafanti.common.model.FollowUpRecord;
  13. import com.goafanti.core.mybatis.BaseMybatisDao;
  14. import com.goafanti.core.shiro.token.TokenManager;
  15. import com.goafanti.customer.bo.CustomerIn;
  16. import com.goafanti.customer.service.FollowUpService;
  17. @Service
  18. public class FollowUpServiceImp extends BaseMybatisDao<CustomerUserInfoMapper> implements FollowUpService{
  19. @Autowired
  20. private FollowUpRecordMapper followUpRecordMapper ;
  21. @Autowired
  22. private CustomerMapper customerMapper;
  23. @Override
  24. public int addFollowUp(FollowUpRecord fur,CustomerIn cusIn) {
  25. Customer cus = new Customer();
  26. try {
  27. BeanUtils.copyProperties(cus, cusIn);
  28. if(StringUtils.isNotBlank(cusIn.getFollowSituation()))
  29. cus.setFollowSituation(Integer.parseInt(cusIn.getFollowSituation()));
  30. if(StringUtils.isNotBlank(cusIn.getCustomerStatus()))
  31. cus.setCustomerStatus(Integer.parseInt(cusIn.getCustomerStatus()));
  32. } catch (IllegalAccessException | InvocationTargetException e) {
  33. e.printStackTrace();
  34. }
  35. fur.setCid(cusIn.getId());
  36. fur.setAid(TokenManager.getAdminId());
  37. followUpRecordMapper.insert(fur);
  38. return customerMapper.updateByPrimaryKeySelective(cus);
  39. }
  40. }