123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package com.caimei.modules.user.service;
- import com.caimei.modules.user.dao.CmUserDao;
- import com.caimei.modules.user.dao.CustomerDao;
- import com.caimei.modules.user.entity.CmUser;
- import com.caimei.modules.user.entity.Customer;
- import com.thinkgem.jeesite.common.persistence.Page;
- import com.thinkgem.jeesite.common.service.CrudService;
- import org.apache.commons.lang.StringUtils;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import javax.annotation.Resource;
- import java.util.Arrays;
- import java.util.List;
- /**
- * ${DESCRIPTION}
- *
- * @author LG
- * @create 2017/2/24
- **/
- @Service
- @Transactional(readOnly = true)
- public class CustomerService extends CrudService<CustomerDao, Customer> {
- @Resource
- private CmUserDao cmUserDao;
- public Customer get(String id) {
- return super.get(id);
- }
- public List<Customer> findList(Customer customer) {
- return super.findList(customer);
- }
- public Page<Customer> findPage(Page<Customer> page, Customer customer) {
- return super.findPage(page, customer);
- }
- @Transactional(readOnly = false)
- public void unbindWx(Customer customer) {
- dao.updateWxUnitByUserId(customer.getId());
- dao.updateCmBindUserIDAndRegisterTypeIDByOpenid(customer.getCrmOpenid());
- dao.updateUserByUserId(customer.getId());
- }
- /**
- * 查找绑定微信的运营人员
- *
- * @param page
- * @param customer
- * @return
- */
- @Transactional(readOnly = false)
- public Page<Customer> findOperationList(Page<Customer> page, Customer customer) {
- customer.setPage(page);
- if (StringUtils.isNotBlank(customer.getRegisterUserTypeID())) {
- if (Arrays.asList(customer.getUserTypeArr()).contains("32")) {
- customer.setMode(2);
- } else {
- customer.setMode(1);
- }
- }
- page.setList(dao.findOperationList(customer));
- return page;
- }
- @Transactional(readOnly = false)
- public void unbindStatus(Integer userId) {
- CmUser user = cmUserDao.get(userId.toString());
- if (user.getUserIdentity() == 1) {
- dao.unbindServiceproviderWX(user.getServiceProviderID());
- } else {
- dao.unbindStatus(userId);
- }
- }
- }
|