CustomerService.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package com.caimei.modules.user.service;
  2. import com.caimei.modules.user.dao.CmUserDao;
  3. import com.caimei.modules.user.dao.CustomerDao;
  4. import com.caimei.modules.user.entity.CmUser;
  5. import com.caimei.modules.user.entity.Customer;
  6. import com.thinkgem.jeesite.common.persistence.Page;
  7. import com.thinkgem.jeesite.common.service.CrudService;
  8. import org.apache.commons.lang.StringUtils;
  9. import org.springframework.stereotype.Service;
  10. import org.springframework.transaction.annotation.Transactional;
  11. import javax.annotation.Resource;
  12. import java.util.Arrays;
  13. import java.util.List;
  14. /**
  15. * ${DESCRIPTION}
  16. *
  17. * @author LG
  18. * @create 2017/2/24
  19. **/
  20. @Service
  21. @Transactional(readOnly = true)
  22. public class CustomerService extends CrudService<CustomerDao, Customer> {
  23. @Resource
  24. private CmUserDao cmUserDao;
  25. public Customer get(String id) {
  26. return super.get(id);
  27. }
  28. public List<Customer> findList(Customer customer) {
  29. return super.findList(customer);
  30. }
  31. public Page<Customer> findPage(Page<Customer> page, Customer customer) {
  32. return super.findPage(page, customer);
  33. }
  34. @Transactional(readOnly = false)
  35. public void unbindWx(Customer customer) {
  36. dao.updateWxUnitByUserId(customer.getId());
  37. dao.updateCmBindUserIDAndRegisterTypeIDByOpenid(customer.getCrmOpenid());
  38. dao.updateUserByUserId(customer.getId());
  39. }
  40. /**
  41. * 查找绑定微信的运营人员
  42. *
  43. * @param page
  44. * @param customer
  45. * @return
  46. */
  47. @Transactional(readOnly = false)
  48. public Page<Customer> findOperationList(Page<Customer> page, Customer customer) {
  49. customer.setPage(page);
  50. if (StringUtils.isNotBlank(customer.getRegisterUserTypeID())) {
  51. if (Arrays.asList(customer.getUserTypeArr()).contains("32")) {
  52. customer.setMode(2);
  53. } else {
  54. customer.setMode(1);
  55. }
  56. }
  57. page.setList(dao.findOperationList(customer));
  58. return page;
  59. }
  60. @Transactional(readOnly = false)
  61. public void unbindStatus(Integer userId) {
  62. CmUser user = cmUserDao.get(userId.toString());
  63. if (user.getUserIdentity() == 1) {
  64. dao.unbindServiceproviderWX(user.getServiceProviderID());
  65. } else {
  66. dao.unbindStatus(userId);
  67. }
  68. }
  69. }