项目源码
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.Department;
|
||||
|
||||
public interface DepartmentDao extends BaseDao<Department, Long>{
|
||||
|
||||
public Page<Department> getPage(int pageNumber, int pageSize,Long enterpriseId,Long pId,String name,String state);
|
||||
|
||||
//取得直接下级
|
||||
public List<Department> listTop(Long enterpriseId,Long pId);
|
||||
public List<Department> listdsub(Long enterpriseId,Long pId);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
|
||||
public interface EAccountDao extends BaseDao<EAccount, Long> {
|
||||
|
||||
public void setState(List<Long> ids, String state);
|
||||
|
||||
public Page<EAccount> getPage(int pageNumber, int pageSize,Long enterpriseId,Long departmentId,String name,String telephone, Long roleId,String state);
|
||||
|
||||
public Page<EAccount> getPage4m(int pageNumber, int pageSize,Long enterpriseId,String name,String telephone, Long roleId,String state);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.EContract;
|
||||
|
||||
public interface EContractDao extends BaseDao<EContract, Long> {
|
||||
|
||||
public void setState(List<Long> ids, String state);
|
||||
|
||||
public Page<EContract> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
|
||||
public interface ECustomerDao extends BaseDao<ECustomer, Long> {
|
||||
|
||||
public List<ECustomer> getAll(String state);
|
||||
|
||||
public void setState(List<Long> ids, String state);
|
||||
|
||||
public Page<ECustomer> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state);
|
||||
|
||||
public Page<ECustomer> getPage4NoVisit(int pageNumber, int pageSize, String startDate, String endDate);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.ECustomerVisit;
|
||||
|
||||
public interface ECustomerVisitDao extends BaseDao<ECustomerVisit, Long> {
|
||||
|
||||
public void setState(List<Long> ids, String state);
|
||||
|
||||
public Page<ECustomerVisit> getPage(int pageNumber, int pageSize, Long customerId, String startDate, String endDate,
|
||||
String state);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
|
||||
public interface EnterpriseDao extends BaseDao<Enterprise, Long>{
|
||||
|
||||
public Page<Enterprise> getPage(int pageNumber, int pageSize,Long pId,String name,String state);
|
||||
|
||||
public List<Enterprise> listAll(String state);
|
||||
|
||||
//取得直接下级
|
||||
public List<Enterprise> listTop(Long pId);
|
||||
public List<Enterprise> listdsub(Long pId);
|
||||
public List<Enterprise> listdsub(Long pId,String type);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.crm.dao.DepartmentDao;
|
||||
import com.kelp.crm.entity.Department;
|
||||
|
||||
@Repository
|
||||
public class DepartmentDaoImpl extends BaseDaoImpl<Department, Long> implements DepartmentDao{
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean delete(List<Long> ids) {
|
||||
for(Long id : ids){
|
||||
delete(id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Long id) {
|
||||
String sqld = "update Department set state = '10' where id = :id ";
|
||||
String sqlq = "select o from Department o where pId = :pId order by orderNumber";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Department> departmentList = em.createQuery(sqlq).setParameter("pId", id).getResultList();
|
||||
if(0 < departmentList.size()){
|
||||
for(Department department : departmentList){
|
||||
delete(department.getId());
|
||||
}
|
||||
}
|
||||
em.createQuery(sqld).setParameter("id", id).executeUpdate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Department> getPage(int pageNumber, int pageSize, Long enterpriseId, Long pId, String name, String state) {
|
||||
if(name == null || name.length() == 0 || name.length() > 50){
|
||||
name = "";
|
||||
}
|
||||
|
||||
if(state == null || state.length() != 2){
|
||||
state = "00";
|
||||
}
|
||||
|
||||
String sql = " from Department o where enterpriseId=?1 and name like ?2 and pId = ?3 and state = ?4 order by orderNumber";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
params.add(enterpriseId);
|
||||
params.add("%" + name + "%");
|
||||
params.add(pId);
|
||||
params.add(state);
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Department> listTop(Long enterpriseId, Long pId) {
|
||||
String sql = "select new com.kelp.crm.entity.Department(o.id,o.name,o.pId,o.idPath) from Department o where id = :pId and enterpriseId = :enterpriseId and state = '00' order by orderNumber";
|
||||
return em.createQuery(sql).setParameter("enterpriseId", enterpriseId).setParameter("pId", pId).getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Department> listdsub(Long enterpriseId,Long pId) {
|
||||
|
||||
String sql = "select new com.kelp.crm.entity.Department(o.id,o.name,o.pId,o.idPath) from Department o where id != pId and enterpriseId = :enterpriseId and pId = :pId and state = '00' order by orderNumber";
|
||||
return em.createQuery(sql).setParameter("enterpriseId", enterpriseId).setParameter("pId", pId).getResultList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.crm.dao.EAccountDao;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
|
||||
@Repository
|
||||
public class EAccountDaoImpl extends BaseDaoImpl<EAccount, Long> implements EAccountDao {
|
||||
|
||||
@Override
|
||||
public Page<EAccount> getPage(int pageNumber, int pageSize, Long enterpriseId, Long departmentId, String name, String telephone, Long roleId,
|
||||
String state) {
|
||||
String sql = " from EAccount o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
sql += " and enterpriseId = ?" + index++;
|
||||
params.add(enterpriseId);
|
||||
|
||||
sql += " and departmentId = ?" + index++;
|
||||
params.add(departmentId);
|
||||
|
||||
if(!StringUtils.isEmpty(name) && name.length() < 50){
|
||||
sql += " and name like ?" + index++;
|
||||
params.add("%" + name + "%");
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(telephone) && telephone.length() <= 32){
|
||||
sql += " and telephone = ?" + index++;
|
||||
params.add(telephone);
|
||||
}
|
||||
|
||||
if(roleId != null ){
|
||||
sql += " and roleId = ?" + index++;
|
||||
params.add(roleId);
|
||||
}
|
||||
|
||||
if(state != null && state.length() == 2){
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setState(List<Long> ids ,String state) {
|
||||
String sql = "update EAccount set state = :state where id in (:ids)";
|
||||
em.createQuery(sql).setParameter("state", state).setParameter("ids", ids).executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EAccount> getPage4m(int pageNumber, int pageSize, Long enterpriseId, String name, String telephone,
|
||||
Long roleId, String state) {
|
||||
String sql = " from EAccount o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
sql += " and enterpriseId = ?" + index++;
|
||||
params.add(enterpriseId);
|
||||
|
||||
if(!StringUtils.isEmpty(name) && name.length() < 50){
|
||||
sql += " and name like ?" + index++;
|
||||
params.add("%" + name + "%");
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(telephone) && telephone.length() <= 32){
|
||||
sql += " and telephone = ?" + index++;
|
||||
params.add(telephone);
|
||||
}
|
||||
|
||||
if(roleId != null ){
|
||||
sql += " and roleId = ?" + index++;
|
||||
params.add(roleId);
|
||||
}
|
||||
|
||||
if(state != null && state.length() == 2){
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
import com.kelp.common.utils.DateUtils;
|
||||
import com.kelp.crm.dao.EContractDao;
|
||||
import com.kelp.crm.entity.EContract;
|
||||
|
||||
@Repository
|
||||
public class EContractDaoImpl extends BaseDaoImpl<EContract, Long> implements EContractDao {
|
||||
|
||||
@Override
|
||||
public Page<EContract> getPage(int pageNumber, int pageSize, String startDate, String endDate,
|
||||
String name, String state) {
|
||||
String sql = " from EContract o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
if (startDate != null && DateUtils.string2date(startDate + " 00:00:00") != null) {
|
||||
sql = sql + " and signTime >= ?" + index++;
|
||||
params.add(DateUtils.string2date(startDate + " 00:00:00").getTime());
|
||||
}
|
||||
|
||||
if (endDate != null && DateUtils.string2date(endDate + " 23:59:59") != null) {
|
||||
sql = sql + " and signTime <= ?" + index++;
|
||||
params.add(DateUtils.string2date(endDate + " 23:59:59").getTime());
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(name) && name.length() <= 50) {
|
||||
sql += " and customerName = ?" + index++;
|
||||
params.add(AESUtil.encrypt(name, KeyConstant.REALNAME));
|
||||
}
|
||||
|
||||
if (state != null && state.length() == 2) {
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
sql += " order by createTime desc";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setState(List<Long> ids, String state) {
|
||||
String sql = "update EContract set state = :state where id in (:ids)";
|
||||
em.createQuery(sql).setParameter("state", state).setParameter("ids", ids).executeUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.common.utils.DateUtils;
|
||||
import com.kelp.crm.dao.ECustomerDao;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
|
||||
@Repository
|
||||
public class ECustomerDaoImpl extends BaseDaoImpl<ECustomer, Long> implements ECustomerDao {
|
||||
|
||||
@Override
|
||||
public Page<ECustomer> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state) {
|
||||
String sql = " from ECustomer o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
if (startDate != null && DateUtils.string2date(startDate + " 00:00:00") != null) {
|
||||
sql = sql + " and createTime >= ?" + index++;
|
||||
params.add(DateUtils.string2date(startDate + " 00:00:00").getTime());
|
||||
}
|
||||
|
||||
if (endDate != null && DateUtils.string2date(endDate + " 23:59:59") != null) {
|
||||
sql = sql + " and createTime <= ?" + index++;
|
||||
params.add(DateUtils.string2date(endDate + " 23:59:59").getTime());
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(name) && name.length() <= 50) {
|
||||
sql += " and name = ?" + index++;
|
||||
params.add(name);
|
||||
}
|
||||
|
||||
if (state != null && state.length() == 2) {
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
sql += " order by createTime desc";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ECustomer> getPage4NoVisit(int pageNumber, int pageSize, String startDate, String endDate) {
|
||||
String sql = " from ECustomer o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
if (startDate == null || DateUtils.string2date(startDate + " 00:00:00") == null) {
|
||||
startDate = DateUtils.date2Day(new Date());
|
||||
}
|
||||
|
||||
if (endDate == null || DateUtils.string2date(endDate + " 23:59:59") == null) {
|
||||
endDate = DateUtils.date2Day(new Date());
|
||||
}
|
||||
|
||||
sql += " and id not in (select distinct customerId from ECustomerVisit where createTime >= ?" + (index++)
|
||||
+ " and createTime <= ?" + (index++) + " and state != '10')";
|
||||
|
||||
params.add(DateUtils.string2date(startDate + " 00:00:00").getTime());
|
||||
params.add(DateUtils.string2date(endDate + " 23:59:59").getTime());
|
||||
|
||||
sql += " order by createTime desc";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setState(List<Long> ids, String state) {
|
||||
String sql = "update ECustomer set state = :state where id in (:ids)";
|
||||
em.createQuery(sql).setParameter("state", state).setParameter("ids", ids).executeUpdate();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<ECustomer> getAll(String state) {
|
||||
if (state == null || state.length() != 2) {
|
||||
return getAll();
|
||||
}
|
||||
String sql = "select o from ECustomer o where state = :state ";
|
||||
return em.createQuery(sql).setParameter("state", state).getResultList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.common.utils.DateUtils;
|
||||
import com.kelp.crm.dao.ECustomerVisitDao;
|
||||
import com.kelp.crm.entity.ECustomerVisit;
|
||||
|
||||
@Repository
|
||||
public class ECustomerVisitDaoImpl extends BaseDaoImpl<ECustomerVisit, Long> implements ECustomerVisitDao {
|
||||
|
||||
@Override
|
||||
public Page<ECustomerVisit> getPage(int pageNumber, int pageSize, Long customerId, String startDate,
|
||||
String endDate, String state) {
|
||||
|
||||
String sql = " from ECustomerVisit o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
if (customerId != null) {
|
||||
sql += " and customerId = ?" + index++;
|
||||
params.add(customerId);
|
||||
}
|
||||
|
||||
if (startDate != null && DateUtils.string2date(startDate + " 00:00:00") != null) {
|
||||
sql = sql + " and visitTime >= ?" + index++;
|
||||
params.add(DateUtils.string2date(startDate + " 00:00:00").getTime());
|
||||
}
|
||||
|
||||
if (endDate != null && DateUtils.string2date(endDate + " 23:59:59") != null) {
|
||||
sql = sql + " and visitTime <= ?" + index++;
|
||||
params.add(DateUtils.string2date(endDate + " 23:59:59").getTime());
|
||||
}
|
||||
|
||||
if (state != null && state.length() == 2) {
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
sql += " order by visitTime desc ";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setState(List<Long> ids, String state) {
|
||||
String sql = "update ECustomerVisit set state = :state where id in (:ids)";
|
||||
em.createQuery(sql).setParameter("state", state).setParameter("ids", ids).executeUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.crm.dao.EnterpriseDao;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
|
||||
@Repository
|
||||
public class EnterpriseDaoImpl extends BaseDaoImpl<Enterprise, Long> implements EnterpriseDao{
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean delete(List<Long> ids) {
|
||||
for(Long id : ids){
|
||||
delete(id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Long id) {
|
||||
String sqld = "update Enterprise set state = '10' where id = :id ";
|
||||
String sqlq = "select o from Enterprise o where pId = :pId order by name";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Enterprise> enterpriseList = em.createQuery(sqlq).setParameter("pId", id).getResultList();
|
||||
if(0 < enterpriseList.size()){
|
||||
for(Enterprise enterprise : enterpriseList){
|
||||
delete(enterprise.getId());
|
||||
}
|
||||
}
|
||||
em.createQuery(sqld).setParameter("id", id).executeUpdate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Enterprise> getPage(int pageNumber, int pageSize, Long pId, String name, String state) {
|
||||
|
||||
String sql = " from Enterprise o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
sql += " and pId = ?" + index++;
|
||||
params.add(pId);
|
||||
|
||||
if(!StringUtils.isEmpty(name) && name.length() < 50){
|
||||
sql += " and name like ?" + index++;
|
||||
params.add("%" + name + "%");
|
||||
}
|
||||
|
||||
if(state != null && state.length() == 2){
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
sql += " order by name";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Enterprise> listTop(Long pId) {
|
||||
String sql = "select new com.kelp.crm.entity.Enterprise(o.id,o.name,o.pId,o.type) from Enterprise o where id = :pId and state = '00' order by name";
|
||||
return em.createQuery(sql).setParameter("pId", pId).getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Enterprise> listdsub(Long pId) {
|
||||
|
||||
String sql = "select new com.kelp.crm.entity.Enterprise(o.id,o.name,o.pId,o.type) from Enterprise o where id != pId and pId = :pId and state = '00' order by name";
|
||||
return em.createQuery(sql).setParameter("pId", pId).getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Enterprise> listdsub(Long pId,String type) {
|
||||
|
||||
String sql = "select new com.kelp.crm.entity.Enterprise(o.id,o.name,o.pId,o.type) from Enterprise o where id != pId and pId = :pId and type = :type and state = '00' order by name";
|
||||
return em.createQuery(sql).setParameter("pId", pId).setParameter("type", type).getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Enterprise> listAll(String state) {
|
||||
if(state == null || state.length() != 2) {
|
||||
return getAll();
|
||||
}
|
||||
String sql = "select o from Enterprise o where state = :state ";
|
||||
return em.createQuery(sql).setParameter("state", state).getResultList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
* 企业部门
|
||||
*/
|
||||
package com.kelp.crm.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.kelp.base.BaseEntity;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
|
||||
@Entity
|
||||
@Table(name = "dt_enterprise_departmemt")
|
||||
public class Department extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Department() {}
|
||||
|
||||
public Department(Long id,String name,Long pId,String idPath) {
|
||||
this.setId(id);
|
||||
this.name = name;
|
||||
this.pId = pId;
|
||||
this.idPath = idPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 所属企业,一个人只能属于一家企业
|
||||
*/
|
||||
@Column(nullable = false,name="enterpriseId")
|
||||
private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 企业id path
|
||||
*/
|
||||
@Column(nullable = false,length = 512)
|
||||
private String eidPath;
|
||||
|
||||
/**
|
||||
* 上级id,如果id=pId则为顶级
|
||||
*/
|
||||
@Column(name="pId",nullable = false)
|
||||
private Long pId;
|
||||
|
||||
/**
|
||||
* id path,默认支持10级
|
||||
*/
|
||||
@Column(nullable = false,length = 512)
|
||||
private String idPath;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@Column(length = 50, nullable = false)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Column(length = 128, nullable = false,name="phone")
|
||||
private String phone_;
|
||||
|
||||
/**
|
||||
* 部门领导
|
||||
*/
|
||||
@Column(length = 50, nullable = false,name="leader")
|
||||
private String leader_;
|
||||
|
||||
/**
|
||||
* 显示排序
|
||||
*/
|
||||
private int orderNumber;
|
||||
|
||||
/**
|
||||
* 00-正常;10删除
|
||||
*/
|
||||
@Column(length = 2, nullable = false)
|
||||
private String state;
|
||||
|
||||
@Transient
|
||||
public Boolean isParent = true;
|
||||
|
||||
public Long getEnterpriseId() {
|
||||
return enterpriseId;
|
||||
}
|
||||
public void setEnterpriseId(Long enterpriseId) {
|
||||
this.enterpriseId = enterpriseId;
|
||||
}
|
||||
|
||||
public String getEidPath() {
|
||||
return eidPath;
|
||||
}
|
||||
public void setEidPath(String eidPath) {
|
||||
this.eidPath = eidPath;
|
||||
}
|
||||
|
||||
public Long getpId() {
|
||||
return pId;
|
||||
}
|
||||
public void setpId(Long pId) {
|
||||
this.pId = pId;
|
||||
}
|
||||
|
||||
public String getIdPath() {
|
||||
return idPath;
|
||||
}
|
||||
public void setIdPath(String idPath) {
|
||||
this.idPath = idPath;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone_ != null ? AESUtil.decrypt(phone_, KeyConstant.TELEPHONE) : "";
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
if (!StringUtils.isEmpty(phone)) {
|
||||
this.phone_ = AESUtil.encrypt(phone, KeyConstant.TELEPHONE);
|
||||
}
|
||||
}
|
||||
|
||||
public String getLeader() {
|
||||
return leader_ != null ? AESUtil.decrypt(leader_, KeyConstant.NAME) : "";
|
||||
}
|
||||
public void setLeader(String leader) {
|
||||
if (!StringUtils.isEmpty(leader)) {
|
||||
this.leader_ = AESUtil.encrypt(leader, KeyConstant.NAME);
|
||||
}
|
||||
}
|
||||
|
||||
public int getOrderNumber() {
|
||||
return orderNumber;
|
||||
}
|
||||
public void setOrderNumber(int orderNumber) {
|
||||
this.orderNumber = orderNumber;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
199
ksafepack-system/src/main/java/com/kelp/crm/entity/EAccount.java
Normal file
199
ksafepack-system/src/main/java/com/kelp/crm/entity/EAccount.java
Normal file
@@ -0,0 +1,199 @@
|
||||
/**
|
||||
* 企业账号
|
||||
*/
|
||||
package com.kelp.crm.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.kelp.base.BaseEntity;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
|
||||
@Entity
|
||||
@Table(name = "dt_enterprise_account")
|
||||
public class EAccount extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 所属企业,一个人只能属于一家企业
|
||||
*/
|
||||
@Column(nullable = false,name="enterpriseId")
|
||||
private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 企业id path
|
||||
*/
|
||||
@Column(nullable = false,length = 512)
|
||||
private String eidPath;
|
||||
|
||||
/**
|
||||
* 所属部门,一个人只能属于一个部门
|
||||
*/
|
||||
@Column(nullable = false,name="departmentId")
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 部门id path
|
||||
*/
|
||||
@Column(nullable = false,length = 512)
|
||||
private String didPath;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Column(nullable = false,name="name",length = 50)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联系电话加密
|
||||
*/
|
||||
@Column(length = 128, nullable = false, name = "telephone")
|
||||
private String telephone_;
|
||||
|
||||
/**
|
||||
* 加密真实姓名
|
||||
*/
|
||||
@Column(length = 128,name = "realName")
|
||||
private String realName_;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Column(length = 128)
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 性别:0-男;1-女;2-未知
|
||||
*/
|
||||
@Column(nullable = false,length = 1)
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 密码,telephone为盐值
|
||||
*/
|
||||
@Column(nullable = false,length=128)
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* role Id
|
||||
*/
|
||||
@Column(nullable = false,name="roleId")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 状态:00-正常,10-锁定
|
||||
*/
|
||||
@Column(nullable = false,length = 2)
|
||||
private String state;
|
||||
|
||||
public Long getEnterpriseId() {
|
||||
return enterpriseId;
|
||||
}
|
||||
public void setEnterpriseId(Long enterpriseId) {
|
||||
this.enterpriseId = enterpriseId;
|
||||
}
|
||||
|
||||
public String getEidPath() {
|
||||
return eidPath;
|
||||
}
|
||||
public void setEidPath(String eidPath) {
|
||||
this.eidPath = eidPath;
|
||||
}
|
||||
|
||||
public Long getDepartmentId() {
|
||||
return departmentId;
|
||||
}
|
||||
public void setDepartmentId(Long departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
public String getDidPath() {
|
||||
return didPath;
|
||||
}
|
||||
public void setDidPath(String didPath) {
|
||||
this.didPath = didPath;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return telephone_ != null ? AESUtil.decrypt(telephone_, KeyConstant.TELEPHONE) : "";
|
||||
}
|
||||
public void setTelephone(String telephone) {
|
||||
if (!StringUtils.isEmpty(telephone)) {
|
||||
this.telephone_ = AESUtil.encrypt(telephone, KeyConstant.TELEPHONE);
|
||||
}
|
||||
}
|
||||
|
||||
public String getRealName() {
|
||||
return realName_ != null ? AESUtil.decrypt(realName_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setRealName(String realName) {
|
||||
if (!StringUtils.isEmpty(realName)) {
|
||||
this.realName_ = AESUtil.encrypt(realName, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将隐私数据处理
|
||||
* @param account
|
||||
* @return
|
||||
*/
|
||||
public EAccount mask() {
|
||||
this.setId(null);
|
||||
this.setCreateTime(null);
|
||||
this.setUpdateTime(null);
|
||||
this.departmentId = null;
|
||||
this.password = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
package com.kelp.crm.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.kelp.base.BaseEntity;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
|
||||
@Entity
|
||||
@Table(name = "dt_enterprise_contract")
|
||||
public class EContract extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 企业,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,name="enterpriseId")
|
||||
// private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 企业id path,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,length = 512)
|
||||
// private String eidPath;
|
||||
|
||||
/**
|
||||
* 部门,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,name="departmentId")
|
||||
// private Long departmentId;
|
||||
|
||||
/**
|
||||
* 部门id path,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,length = 512)
|
||||
// private String didPath;
|
||||
|
||||
|
||||
/**
|
||||
* 客户id,不可修改
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 客户名称,不可修改
|
||||
*/
|
||||
@Column(nullable = false,name="customerName",length = 128)
|
||||
private String customerName_;
|
||||
|
||||
/**
|
||||
* 录入人,不可修改
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private Long accountId;
|
||||
|
||||
/**
|
||||
* 录入人姓名,不可修改
|
||||
*/
|
||||
@Column(length = 128,nullable = false,name="accountName")
|
||||
private String accountName_;
|
||||
|
||||
/**
|
||||
* 我方签订人
|
||||
*/
|
||||
@Column(length = 128,nullable = false,name="staffName")
|
||||
private String staffName_;
|
||||
|
||||
/**
|
||||
* 甲方签订人
|
||||
*/
|
||||
@Column(length = 128,nullable = false,name="customerSignatory")
|
||||
private String customerSignatory_;
|
||||
|
||||
/**
|
||||
* 签订时间
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private Long signTime;
|
||||
|
||||
/**
|
||||
* 合同终止时间
|
||||
*/
|
||||
private Long endTime;
|
||||
|
||||
/**
|
||||
* 合同金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 发票情况
|
||||
*/
|
||||
@Column(length = 1024)
|
||||
private String fapiao;
|
||||
|
||||
/**
|
||||
* 回款情况
|
||||
*/
|
||||
@Column(length = 1024)
|
||||
private String dso;
|
||||
|
||||
/**
|
||||
* 备注或内容
|
||||
*/
|
||||
@Column(length = 1024)
|
||||
private String content;
|
||||
|
||||
|
||||
/**
|
||||
* 状态:00-正常,10-删除
|
||||
*/
|
||||
@Column(nullable = false,length = 2)
|
||||
private String state;
|
||||
|
||||
// public Long getEnterpriseId() {
|
||||
// return enterpriseId;
|
||||
// }
|
||||
// public void setEnterpriseId(Long enterpriseId) {
|
||||
// this.enterpriseId = enterpriseId;
|
||||
// }
|
||||
|
||||
// public String getEidPath() {
|
||||
// return eidPath;
|
||||
// }
|
||||
// public void setEidPath(String eidPath) {
|
||||
// this.eidPath = eidPath;
|
||||
// }
|
||||
|
||||
// public Long getDepartmentId() {
|
||||
// return departmentId;
|
||||
// }
|
||||
// public void setDepartmentId(Long departmentId) {
|
||||
// this.departmentId = departmentId;
|
||||
// }
|
||||
|
||||
// public String getDidPath() {
|
||||
// return didPath;
|
||||
// }
|
||||
// public void setDidPath(String didPath) {
|
||||
// this.didPath = didPath;
|
||||
// }
|
||||
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
public void setAccountId(Long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName_ != null ? AESUtil.decrypt(accountName_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setAccountName(String accountName) {
|
||||
if (!StringUtils.isEmpty(accountName)) {
|
||||
this.accountName_ = AESUtil.encrypt(accountName, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getStaffName() {
|
||||
return staffName_ != null ? AESUtil.decrypt(staffName_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setStaffName(String staffName) {
|
||||
if (!StringUtils.isEmpty(staffName)) {
|
||||
this.staffName_ = AESUtil.encrypt(staffName, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public Long getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
public void setCustomerId(Long customerId) {
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return customerName_ != null ? AESUtil.decrypt(customerName_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setCustomerName(String customerName) {
|
||||
if (!StringUtils.isEmpty(customerName)) {
|
||||
this.customerName_ = AESUtil.encrypt(customerName, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getCustomerSignatory() {
|
||||
return customerSignatory_ != null ? AESUtil.decrypt(customerSignatory_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setCustomerSignatory(String customerSignatory) {
|
||||
if (!StringUtils.isEmpty(customerSignatory)) {
|
||||
this.customerSignatory_ = AESUtil.encrypt(customerSignatory, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public Long getSignTime() {
|
||||
return signTime;
|
||||
}
|
||||
public void setSignTime(Long signTime) {
|
||||
this.signTime = signTime;
|
||||
}
|
||||
|
||||
public Long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public void setEndTime(Long endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getFapiao() {
|
||||
return fapiao;
|
||||
}
|
||||
public void setFapiao(String fapiao) {
|
||||
this.fapiao = fapiao;
|
||||
}
|
||||
|
||||
public String getDso() {
|
||||
return dso;
|
||||
}
|
||||
public void setDso(String dso) {
|
||||
this.dso = dso;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* 客户
|
||||
*/
|
||||
package com.kelp.crm.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.kelp.base.BaseEntity;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
|
||||
@Entity
|
||||
@Table(name = "dt_enterprise_customer")
|
||||
public class ECustomer extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 当前所属企业,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,name="enterpriseId")
|
||||
// private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 企业id path,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,length = 512)
|
||||
// private String eidPath;
|
||||
|
||||
/**
|
||||
* 当前所属部门,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,name="departmentId")
|
||||
// private Long departmentId;
|
||||
|
||||
/**
|
||||
* 部门id path,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,length = 512)
|
||||
// private String didPath;
|
||||
|
||||
/**
|
||||
* 录入人,不可修改,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false)
|
||||
// private Long accountId;
|
||||
|
||||
/**
|
||||
* 录入人姓名,不可修改,目前不使用
|
||||
*/
|
||||
// @Column(length = 128,nullable = false,name = "accountName")
|
||||
// private String accountName_;
|
||||
|
||||
/**
|
||||
* 跟单人
|
||||
*/
|
||||
@Column(length = 128,name="staffName")
|
||||
private String staffName_;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
@Column(nullable = false,name="name",length = 128,unique = true)
|
||||
private String name_;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@Column(length = 128, nullable = false,name="contact")
|
||||
private String contact_;
|
||||
|
||||
/**
|
||||
* 联系电话加密
|
||||
*/
|
||||
@Column(length = 128, nullable = false, name = "telephone")
|
||||
private String telephone_;
|
||||
|
||||
/**
|
||||
* 最后有效日期始
|
||||
*/
|
||||
private long effctiveTime;
|
||||
|
||||
/**
|
||||
* 最后有效日期止
|
||||
*/
|
||||
private long expiredTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(length=256)
|
||||
private String description;
|
||||
|
||||
|
||||
/**
|
||||
* 状态:00-待签约,01-签约,10-死单,11-删除
|
||||
*/
|
||||
@Column(nullable = false,length = 2)
|
||||
private String state;
|
||||
|
||||
// public Long getEnterpriseId() {
|
||||
// return enterpriseId;
|
||||
// }
|
||||
// public void setEnterpriseId(Long enterpriseId) {
|
||||
// this.enterpriseId = enterpriseId;
|
||||
// }
|
||||
|
||||
// public String getEidPath() {
|
||||
// return eidPath;
|
||||
// }
|
||||
// public void setEidPath(String eidPath) {
|
||||
// this.eidPath = eidPath;
|
||||
// }
|
||||
|
||||
// public Long getDepartmentId() {
|
||||
// return departmentId;
|
||||
// }
|
||||
// public void setDepartmentId(Long departmentId) {
|
||||
// this.departmentId = departmentId;
|
||||
// }
|
||||
|
||||
// public String getDidPath() {
|
||||
// return didPath;
|
||||
// }
|
||||
// public void setDidPath(String didPath) {
|
||||
// this.didPath = didPath;
|
||||
// }
|
||||
|
||||
// public Long getAccountId() {
|
||||
// return accountId;
|
||||
// }
|
||||
// public void setAccountId(Long accountId) {
|
||||
// this.accountId = accountId;
|
||||
// }
|
||||
|
||||
// public String getAccountName() {
|
||||
// return accountName_ != null ? AESUtil.decrypt(accountName_, KeyConstant.REALNAME) : "";
|
||||
// }
|
||||
// public void setAccountName(String accountName) {
|
||||
// if (!StringUtils.isEmpty(accountName)) {
|
||||
// this.accountName_ = AESUtil.encrypt(accountName, KeyConstant.REALNAME);
|
||||
// }
|
||||
// }
|
||||
|
||||
public String getName() {
|
||||
return name_ != null ? AESUtil.decrypt(name_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setName(String name) {
|
||||
if (!StringUtils.isEmpty(name)) {
|
||||
this.name_ = AESUtil.encrypt(name, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getContact() {
|
||||
return contact_ != null ? AESUtil.decrypt(contact_, KeyConstant.NAME) : "";
|
||||
}
|
||||
public void setContact(String contact) {
|
||||
if(!StringUtils.isEmpty(contact)) {
|
||||
this.contact_ = AESUtil.encrypt(contact, KeyConstant.NAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return telephone_ != null ? AESUtil.decrypt(telephone_, KeyConstant.TELEPHONE) : "";
|
||||
}
|
||||
public void setTelephone(String telephone) {
|
||||
if (!StringUtils.isEmpty(telephone)) {
|
||||
this.telephone_ = AESUtil.encrypt(telephone, KeyConstant.TELEPHONE);
|
||||
}
|
||||
}
|
||||
|
||||
public String getStaffName() {
|
||||
return staffName_ != null ? AESUtil.decrypt(staffName_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setStaffName(String staffName) {
|
||||
if (!StringUtils.isEmpty(staffName)) {
|
||||
this.staffName_ = AESUtil.encrypt(staffName, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public long getEffctiveTime() {
|
||||
return effctiveTime;
|
||||
}
|
||||
public void setEffctiveTime(long effctiveTime) {
|
||||
this.effctiveTime = effctiveTime;
|
||||
}
|
||||
|
||||
public long getExpiredTime() {
|
||||
return expiredTime;
|
||||
}
|
||||
public void setExpiredTime(long expiredTime) {
|
||||
this.expiredTime = expiredTime;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
/**
|
||||
* 客户拜访记录
|
||||
*/
|
||||
package com.kelp.crm.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.kelp.base.BaseEntity;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
|
||||
@Entity
|
||||
@Table(name = "dt_enterprise_customer_visit")
|
||||
public class ECustomerVisit extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 企业,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,name="enterpriseId")
|
||||
// private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 企业id path,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,length = 512)
|
||||
// private String eidPath;
|
||||
|
||||
/**
|
||||
* 部门,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,name="departmentId")
|
||||
// private Long departmentId;
|
||||
|
||||
/**
|
||||
* 部门id path,目前不使用
|
||||
*/
|
||||
// @Column(nullable = false,length = 512)
|
||||
// private String didPath;
|
||||
|
||||
/**
|
||||
* 录入人,不可修改
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private Long accountId;
|
||||
|
||||
/**
|
||||
* 录入人姓名,不可修改
|
||||
*/
|
||||
@Column(length = 128,nullable = false,name="accountName")
|
||||
private String accountName_;
|
||||
|
||||
/**
|
||||
* 拜访人
|
||||
*/
|
||||
@Column(length = 128,nullable = false,name="staffName")
|
||||
private String staffName_;
|
||||
|
||||
/**
|
||||
* 约见人
|
||||
*/
|
||||
@Column(length = 128,nullable = false,name="visiter")
|
||||
private String visiter_;
|
||||
|
||||
/**
|
||||
* 约见人
|
||||
*/
|
||||
@Column(length = 128,nullable = false,name="visiterTelephone")
|
||||
private String visiterTelephone_;
|
||||
|
||||
/**
|
||||
* 拜访时间
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private Long visitTime;
|
||||
|
||||
/**
|
||||
* 客户id,不可修改
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 客户名称,不可修改
|
||||
*/
|
||||
@Column(nullable = false,name="customerName",length = 128)
|
||||
private String customerName_;
|
||||
|
||||
/**
|
||||
* 联系电话加密
|
||||
*/
|
||||
@Column(length = 128, nullable = false, name = "customerTelephone")
|
||||
private String customerTelephone_;
|
||||
|
||||
/**
|
||||
* 拜访内容及结果
|
||||
*/
|
||||
@Column(length = 1024,nullable = false)
|
||||
private String content;
|
||||
|
||||
|
||||
/**
|
||||
* 状态:00-待签约,01-签约,10-死单,11-删除
|
||||
*/
|
||||
@Column(nullable = false,length = 2)
|
||||
private String state;
|
||||
|
||||
// public Long getEnterpriseId() {
|
||||
// return enterpriseId;
|
||||
// }
|
||||
// public void setEnterpriseId(Long enterpriseId) {
|
||||
// this.enterpriseId = enterpriseId;
|
||||
// }
|
||||
|
||||
// public String getEidPath() {
|
||||
// return eidPath;
|
||||
// }
|
||||
// public void setEidPath(String eidPath) {
|
||||
// this.eidPath = eidPath;
|
||||
// }
|
||||
|
||||
// public Long getDepartmentId() {
|
||||
// return departmentId;
|
||||
// }
|
||||
// public void setDepartmentId(Long departmentId) {
|
||||
// this.departmentId = departmentId;
|
||||
// }
|
||||
|
||||
// public String getDidPath() {
|
||||
// return didPath;
|
||||
// }
|
||||
// public void setDidPath(String didPath) {
|
||||
// this.didPath = didPath;
|
||||
// }
|
||||
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
public void setAccountId(Long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName_ != null ? AESUtil.decrypt(accountName_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setAccountName(String accountName) {
|
||||
if (!StringUtils.isEmpty(accountName)) {
|
||||
this.accountName_ = AESUtil.encrypt(accountName, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getStaffName() {
|
||||
return staffName_ != null ? AESUtil.decrypt(staffName_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setStaffName(String staffName) {
|
||||
if (!StringUtils.isEmpty(staffName)) {
|
||||
this.staffName_ = AESUtil.encrypt(staffName, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getVisiter() {
|
||||
return visiter_ != null ? AESUtil.decrypt(visiter_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setVisiter(String visiter) {
|
||||
if (!StringUtils.isEmpty(visiter)) {
|
||||
this.visiter_ = AESUtil.encrypt(visiter, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getVisiterTelephone() {
|
||||
return visiterTelephone_ != null ? AESUtil.decrypt(visiterTelephone_, KeyConstant.TELEPHONE) : "";
|
||||
}
|
||||
public void setVisiterTelephone(String visiterTelephone) {
|
||||
if (!StringUtils.isEmpty(visiterTelephone)) {
|
||||
this.visiterTelephone_ = AESUtil.encrypt(visiterTelephone, KeyConstant.TELEPHONE);
|
||||
}
|
||||
}
|
||||
|
||||
public Long getVisitTime() {
|
||||
return visitTime;
|
||||
}
|
||||
public void setVisitTime(Long visitTime) {
|
||||
this.visitTime = visitTime;
|
||||
}
|
||||
|
||||
public Long getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
public void setCustomerId(Long customerId) {
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return customerName_ != null ? AESUtil.decrypt(customerName_, KeyConstant.REALNAME) : "";
|
||||
}
|
||||
public void setCustomerName(String customerName) {
|
||||
if (!StringUtils.isEmpty(customerName)) {
|
||||
this.customerName_ = AESUtil.encrypt(customerName, KeyConstant.REALNAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getCustomerTelephone() {
|
||||
return customerTelephone_ != null ? AESUtil.decrypt(customerTelephone_, KeyConstant.TELEPHONE) : "";
|
||||
}
|
||||
public void setCustomerTelephone(String customerTelephone) {
|
||||
if (!StringUtils.isEmpty(customerTelephone)) {
|
||||
this.customerTelephone_ = AESUtil.encrypt(customerTelephone, KeyConstant.TELEPHONE);
|
||||
}
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* 企业
|
||||
*/
|
||||
package com.kelp.crm.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.kelp.base.BaseEntity;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
|
||||
@Entity
|
||||
@Table(name = "dt_enterprise")
|
||||
public class Enterprise extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Enterprise() {}
|
||||
|
||||
public Enterprise(Long id,String name,Long pId,String type) {
|
||||
this.setId(id);
|
||||
this.name = name;
|
||||
this.pId = pId;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 类型:00-企业;01-代理
|
||||
*/
|
||||
@Column(length = 2,nullable = false)
|
||||
private String type = "00";
|
||||
|
||||
/**
|
||||
* 上级id,如果id=pId则为顶级
|
||||
*/
|
||||
@Column(name="pId",nullable = false)
|
||||
private Long pId;
|
||||
|
||||
/**
|
||||
* id path,默认支持10级
|
||||
*/
|
||||
@Column(nullable = false,length = 512)
|
||||
private String idPath;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Column(nullable = false,name="name",length = 50,unique = true)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联系电话加密
|
||||
*/
|
||||
@Column(length = 128, nullable = false, name = "telephone")
|
||||
private String telephone_;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@Column(length = 50, nullable = false,name="contact")
|
||||
private String contact_;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@Column(length = 128)
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
@Lob
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 状态:00-正常,10-锁定
|
||||
*/
|
||||
@Column(nullable = false,length = 2)
|
||||
private String state;
|
||||
|
||||
@Transient
|
||||
public Boolean isParent = true;
|
||||
|
||||
public Long getpId() {
|
||||
return pId;
|
||||
}
|
||||
public void setpId(Long pId) {
|
||||
this.pId = pId;
|
||||
}
|
||||
|
||||
public String getIdPath() {
|
||||
return idPath;
|
||||
}
|
||||
public void setIdPath(String idPath) {
|
||||
this.idPath = idPath;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return telephone_ != null ? AESUtil.decrypt(telephone_, KeyConstant.TELEPHONE) : "";
|
||||
}
|
||||
public void setTelephone(String telephone) {
|
||||
if(!StringUtils.isEmpty(telephone)) {
|
||||
this.telephone_ = AESUtil.encrypt(telephone, KeyConstant.TELEPHONE);
|
||||
}
|
||||
}
|
||||
|
||||
public String getContact() {
|
||||
return contact_ != null ? AESUtil.decrypt(contact_, KeyConstant.NAME) : "";
|
||||
}
|
||||
public void setContact(String contact) {
|
||||
if(!StringUtils.isEmpty(contact)) {
|
||||
this.contact_ = AESUtil.encrypt(contact, KeyConstant.NAME);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.kelp.crm.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.Department;
|
||||
|
||||
public interface DepartmentService {
|
||||
|
||||
public void add(Department department);
|
||||
|
||||
public void update(Department department);
|
||||
|
||||
public void delete(String[] ids);
|
||||
|
||||
public Department getById(String id);
|
||||
|
||||
//
|
||||
public Page<Department> getPage(int pageNumber, int pageSize,String enterpriseId,String pId,String name,String state);
|
||||
|
||||
//取得直接下级
|
||||
public List<Department> listTop(String enterpriseId,String pId);
|
||||
public List<Department> listdsub(String enterpriseId,String pId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.kelp.crm.service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
|
||||
public interface EAccountService {
|
||||
|
||||
public void add(EAccount account);
|
||||
|
||||
public void add4m(EAccount account);
|
||||
|
||||
public void update(EAccount account);
|
||||
|
||||
public void update4m(EAccount account);
|
||||
|
||||
public EAccount getById(String id);
|
||||
|
||||
public EAccount getByTelephone(String telephone);
|
||||
|
||||
public EAccount getBySelfId(String selfId);
|
||||
|
||||
public void delete(String[] ids);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param name - 昵称
|
||||
* @param telephone
|
||||
* @param roleId
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
public Page<EAccount> getPage(int pageNumber, int pageSize, String enterpriseId, String departmentId, String name,
|
||||
String telephone, String roleId, String state);
|
||||
|
||||
/**
|
||||
* 公司管理员查询
|
||||
*
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param enterpriseId
|
||||
* @param name
|
||||
* @param telephone
|
||||
* @param roleId
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
public Page<EAccount> getPage4m(int pageNumber, int pageSize, String enterpriseId, String name, String telephone,
|
||||
String roleId, String state);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.kelp.crm.service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.EContract;
|
||||
|
||||
public interface EContractService {
|
||||
|
||||
public void add(EContract contract);
|
||||
|
||||
public void update(EContract contract);
|
||||
|
||||
public EContract getById(String id);
|
||||
|
||||
public void delete(String[] ids);
|
||||
|
||||
public Page<EContract> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.kelp.crm.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
|
||||
public interface ECustomerService {
|
||||
|
||||
public ECustomer add(ECustomer customer);
|
||||
|
||||
public void update(ECustomer customer);
|
||||
|
||||
public ECustomer getByName(String name);
|
||||
|
||||
public ECustomer getById(String id);
|
||||
|
||||
public void delete(String[] ids);
|
||||
|
||||
public List<ECustomer> getAll(String state);
|
||||
|
||||
public Page<ECustomer> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state);
|
||||
|
||||
public Page<ECustomer> getPage4NoVisit(int pageNumber, int pageSize, String startDate, String endDate);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.kelp.crm.service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.ECustomerVisit;
|
||||
|
||||
public interface ECustomerVisitService {
|
||||
|
||||
public void add(ECustomerVisit customerVisit);
|
||||
|
||||
public void update(ECustomerVisit customerVisit);
|
||||
|
||||
public ECustomerVisit getById(String id);
|
||||
|
||||
public void delete(String[] ids);
|
||||
|
||||
public Page<ECustomerVisit> getPage(int pageNumber, int pageSize, String customerId, String startDate,
|
||||
String endDate, String state);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.kelp.crm.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
|
||||
public interface EnterpriseService {
|
||||
|
||||
public void add(Enterprise company);
|
||||
|
||||
public void update(Enterprise company);
|
||||
|
||||
public void delete(String[] ids);
|
||||
|
||||
public Enterprise getById(String id);
|
||||
|
||||
public Enterprise getByName(String name);
|
||||
|
||||
public List<Enterprise> listAll(String state);
|
||||
|
||||
//
|
||||
public Page<Enterprise> getPage(int pageNumber, int pageSize,String pId,String name,String state);
|
||||
|
||||
//取得直接下级
|
||||
public List<Enterprise> listTop(Long pId);
|
||||
public List<Enterprise> listdsub(String pId);
|
||||
public List<Enterprise> listdsub(String pId ,String type);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.kelp.crm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.utils.IdWorker;
|
||||
import com.kelp.crm.dao.DepartmentDao;
|
||||
import com.kelp.crm.dao.EnterpriseDao;
|
||||
import com.kelp.crm.entity.Department;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
import com.kelp.crm.service.DepartmentService;
|
||||
|
||||
@Service
|
||||
public class DepartmentServiceImpl implements DepartmentService {
|
||||
|
||||
@Autowired
|
||||
private IdWorker idWorker;
|
||||
|
||||
@Autowired
|
||||
private DepartmentDao departmentDao;
|
||||
|
||||
@Autowired
|
||||
private EnterpriseDao enterpriseDao;
|
||||
|
||||
@Override
|
||||
public void add(Department department) {
|
||||
Enterprise enterprise = enterpriseDao.get(department.getEnterpriseId());
|
||||
department.setEidPath(enterprise != null?enterprise.getIdPath():"0");
|
||||
|
||||
department.setId(idWorker.nextId());
|
||||
//先设为0
|
||||
department.setIdPath("0");
|
||||
//保存之后处理
|
||||
Department pdepartment = departmentDao.get(department.getpId());
|
||||
department.setIdPath((pdepartment != null?pdepartment.getIdPath():"0") + "-" + String.valueOf(department.getId()));
|
||||
departmentDao.update(department);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Department department) {
|
||||
Enterprise enterprise = enterpriseDao.get(department.getEnterpriseId());
|
||||
department.setEidPath(enterprise != null?enterprise.getIdPath():"0");
|
||||
|
||||
Department pdepartment = departmentDao.get(department.getpId());
|
||||
department.setIdPath((pdepartment != null?pdepartment.getIdPath():"0") + "-" + String.valueOf(department.getId()));
|
||||
departmentDao.update(department);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String[] ids) {
|
||||
List<Long> ids_ = new ArrayList<Long>();
|
||||
for(String id : ids){
|
||||
try {
|
||||
ids_.add(Long.valueOf(id));
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
departmentDao.delete(ids_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Department getById(String id) {
|
||||
return departmentDao.get(Long.valueOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Department> getPage(int pageNumber, int pageSize,String enterpriseId,String pId,String name,String state) {
|
||||
|
||||
Page<Department> page = departmentDao.getPage(pageNumber, pageSize,Long.valueOf(enterpriseId),Long.valueOf(pId),name,state);
|
||||
|
||||
if(page == null){
|
||||
page = new Page<Department>();
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Department> listTop(String enterpriseId, String pId) {
|
||||
return departmentDao.listTop(Long.valueOf(enterpriseId),Long.valueOf(pId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Department> listdsub(String enterpriseId,String pId) {
|
||||
return departmentDao.listdsub(Long.valueOf(enterpriseId),Long.valueOf(pId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.kelp.crm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
import com.kelp.common.utils.IdWorker;
|
||||
import com.kelp.crm.dao.DepartmentDao;
|
||||
import com.kelp.crm.dao.EAccountDao;
|
||||
import com.kelp.crm.dao.EnterpriseDao;
|
||||
import com.kelp.crm.entity.Department;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
import com.kelp.crm.service.EAccountService;
|
||||
|
||||
@Service
|
||||
public class EAccountServiceImpl implements EAccountService {
|
||||
|
||||
@Autowired
|
||||
private IdWorker idWorker;
|
||||
|
||||
@Autowired
|
||||
private EAccountDao accountDao;
|
||||
|
||||
@Autowired
|
||||
private DepartmentDao departmentDao;
|
||||
|
||||
@Autowired
|
||||
private EnterpriseDao enterpriseDao;
|
||||
|
||||
@Override
|
||||
public EAccount getByTelephone(String telephone) {
|
||||
return accountDao.get("telephone_", AESUtil.encrypt(telephone, KeyConstant.TELEPHONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EAccount getBySelfId(String selfId) {
|
||||
return accountDao.get("selfId_", AESUtil.encrypt(selfId, KeyConstant.SELFID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(EAccount account) {
|
||||
Department department = departmentDao.get(account.getDepartmentId());
|
||||
account.setId(idWorker.nextId());
|
||||
account.setEidPath(department != null?department.getEidPath():"0");
|
||||
account.setDidPath(department != null?department.getIdPath():"0");
|
||||
accountDao.add(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add4m(EAccount account) {
|
||||
Enterprise enterprise = enterpriseDao.get(account.getEnterpriseId());
|
||||
account.setId(idWorker.nextId());
|
||||
account.setEidPath(enterprise != null?enterprise.getIdPath():"0");
|
||||
account.setDepartmentId(0L);
|
||||
account.setDidPath("0");
|
||||
accountDao.add(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(EAccount account) {
|
||||
Department department = departmentDao.get(account.getDepartmentId());
|
||||
account.setEidPath(department != null?department.getEidPath():"0");
|
||||
account.setDidPath(department != null?department.getIdPath():"0");
|
||||
accountDao.update(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update4m(EAccount account) {
|
||||
Enterprise enterprise = enterpriseDao.get(account.getEnterpriseId());
|
||||
account.setEidPath(enterprise != null?enterprise.getIdPath():"0");
|
||||
account.setDepartmentId(0L);
|
||||
account.setDidPath("0");
|
||||
accountDao.update(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EAccount getById(String id) {
|
||||
return accountDao.get(Long.valueOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String[] ids) {
|
||||
List<Long> ids_ = new ArrayList<Long>();
|
||||
for(String id : ids){
|
||||
try {
|
||||
ids_.add(Long.valueOf(id));
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
accountDao.setState(ids_, "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EAccount> getPage(int pageNumber, int pageSize, String enterpriseId, String departmentId, String name, String telephone, String roleId,
|
||||
String state) {
|
||||
Page<EAccount> page = accountDao.getPage(pageNumber, pageSize,Long.valueOf(enterpriseId),(!StringUtils.isEmpty(departmentId))?Long.valueOf(departmentId) : null, name, !StringUtils.isEmpty(telephone) ? AESUtil.encrypt(telephone, KeyConstant.TELEPHONE) : null, (!StringUtils.isEmpty(roleId))?Long.valueOf(roleId) : null, state);
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<EAccount>();
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EAccount> getPage4m(int pageNumber, int pageSize, String enterpriseId, String name, String telephone, String roleId,
|
||||
String state) {
|
||||
Page<EAccount> page = accountDao.getPage4m(pageNumber, pageSize,Long.valueOf(enterpriseId), name, !StringUtils.isEmpty(telephone) ? AESUtil.encrypt(telephone, KeyConstant.TELEPHONE) : null, (!StringUtils.isEmpty(roleId))?Long.valueOf(roleId) : null, state);
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<EAccount>();
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.kelp.crm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.utils.IdWorker;
|
||||
import com.kelp.crm.dao.EAccountDao;
|
||||
import com.kelp.crm.dao.EContractDao;
|
||||
import com.kelp.crm.dao.ECustomerDao;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
import com.kelp.crm.entity.EContract;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
import com.kelp.crm.service.EContractService;
|
||||
|
||||
@Service
|
||||
public class EContractServiceImpl implements EContractService {
|
||||
|
||||
@Autowired
|
||||
private IdWorker idWorker;
|
||||
|
||||
@Autowired
|
||||
private ECustomerDao customerDao;
|
||||
|
||||
@Autowired
|
||||
private EAccountDao accountDao;
|
||||
|
||||
@Autowired
|
||||
private EContractDao contractDao;
|
||||
|
||||
@Override
|
||||
public void add(EContract contract) {
|
||||
// 设置默认值
|
||||
EAccount account = accountDao.get(contract.getAccountId());
|
||||
ECustomer customer = customerDao.get(contract.getCustomerId());
|
||||
|
||||
if (account == null || customer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
contract.setId(idWorker.nextId());
|
||||
contract.setAccountName(account.getName());
|
||||
contract.setCustomerName(customer.getName());
|
||||
contractDao.add(contract);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(EContract contract) {
|
||||
contractDao.update(contract);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EContract getById(String id) {
|
||||
return contractDao.get(Long.valueOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String[] ids) {
|
||||
List<Long> ids_ = new ArrayList<Long>();
|
||||
for (String id : ids) {
|
||||
try {
|
||||
ids_.add(Long.valueOf(id));
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
contractDao.setState(ids_, "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EContract> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state) {
|
||||
Page<EContract> page = contractDao.getPage(pageNumber, pageSize, startDate, endDate, name, state);
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<EContract>();
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.kelp.crm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
import com.kelp.common.utils.IdWorker;
|
||||
import com.kelp.crm.dao.ECustomerDao;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
import com.kelp.crm.service.ECustomerService;
|
||||
|
||||
@Service
|
||||
public class ECustomerServiceImpl implements ECustomerService {
|
||||
|
||||
@Autowired
|
||||
private IdWorker idWorker;
|
||||
|
||||
@Autowired
|
||||
private ECustomerDao customerDao;
|
||||
|
||||
@Override
|
||||
public ECustomer add(ECustomer customer) {
|
||||
customer.setId(idWorker.nextId());
|
||||
customerDao.add(customer);
|
||||
return customer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ECustomer customer) {
|
||||
customerDao.update(customer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ECustomer getByName(String name) {
|
||||
return customerDao.get("name_", AESUtil.encrypt(name, KeyConstant.REALNAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ECustomer getById(String id) {
|
||||
return customerDao.get(Long.valueOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String[] ids) {
|
||||
List<Long> ids_ = new ArrayList<Long>();
|
||||
for (String id : ids) {
|
||||
try {
|
||||
ids_.add(Long.valueOf(id));
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
customerDao.setState(ids_, "11");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ECustomer> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state) {
|
||||
Page<ECustomer> page = customerDao.getPage(pageNumber, pageSize, startDate, endDate, name, state);
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<ECustomer>();
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ECustomer> getPage4NoVisit(int pageNumber, int pageSize, String startDate, String endDate) {
|
||||
Page<ECustomer> page = customerDao.getPage4NoVisit(pageNumber, pageSize, startDate, endDate);
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<ECustomer>();
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ECustomer> getAll(String state) {
|
||||
return customerDao.getAll(state);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.kelp.crm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.utils.IdWorker;
|
||||
import com.kelp.crm.dao.EAccountDao;
|
||||
import com.kelp.crm.dao.ECustomerDao;
|
||||
import com.kelp.crm.dao.ECustomerVisitDao;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
import com.kelp.crm.entity.ECustomerVisit;
|
||||
import com.kelp.crm.service.ECustomerVisitService;
|
||||
|
||||
@Service
|
||||
public class ECustomerVisitServiceImpl implements ECustomerVisitService {
|
||||
|
||||
@Autowired
|
||||
private IdWorker idWorker;
|
||||
|
||||
@Autowired
|
||||
private ECustomerVisitDao customerVisitDao;
|
||||
|
||||
@Autowired
|
||||
private ECustomerDao customerDao;
|
||||
|
||||
@Autowired
|
||||
private EAccountDao accountDao;
|
||||
|
||||
@Override
|
||||
public void add(ECustomerVisit customerVisit) {
|
||||
// 设置默认值
|
||||
ECustomer customer = customerDao.get(customerVisit.getCustomerId());
|
||||
EAccount account = accountDao.get(customerVisit.getAccountId());
|
||||
|
||||
if (customer == null || account == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
customerVisit.setId(idWorker.nextId());
|
||||
customerVisit.setAccountName(account.getRealName());
|
||||
|
||||
customerVisit.setCustomerName(customer.getName());
|
||||
customerVisit.setCustomerTelephone(customer.getTelephone());
|
||||
|
||||
customerVisitDao.add(customerVisit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ECustomerVisit customerVisit) {
|
||||
customerVisitDao.update(customerVisit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ECustomerVisit getById(String id) {
|
||||
return customerVisitDao.get(Long.valueOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String[] ids) {
|
||||
List<Long> ids_ = new ArrayList<Long>();
|
||||
for (String id : ids) {
|
||||
try {
|
||||
ids_.add(Long.valueOf(id));
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
customerVisitDao.setState(ids_, "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ECustomerVisit> getPage(int pageNumber, int pageSize, String customerId, String startDate,
|
||||
String endDate, String state) {
|
||||
|
||||
Page<ECustomerVisit> page = customerVisitDao.getPage(pageNumber, pageSize,
|
||||
customerId != null ? Long.valueOf(customerId) : null, startDate, endDate, state);
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<ECustomerVisit>();
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.kelp.crm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.utils.IdWorker;
|
||||
import com.kelp.crm.dao.EnterpriseDao;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
import com.kelp.crm.service.EnterpriseService;
|
||||
|
||||
@Service
|
||||
public class EnterpriseServiceImpl implements EnterpriseService {
|
||||
|
||||
@Autowired
|
||||
private IdWorker idWorker;
|
||||
|
||||
@Autowired
|
||||
private EnterpriseDao enterpriseDao;
|
||||
|
||||
@Override
|
||||
public void add(Enterprise enterprise) {
|
||||
enterprise.setId(idWorker.nextId());
|
||||
enterprise.setIdPath("0");
|
||||
Enterprise penterprise = enterpriseDao.get(enterprise.getpId());
|
||||
enterprise.setIdPath((penterprise != null ? penterprise.getIdPath(): "0") + "-" + String.valueOf(enterprise.getId()));
|
||||
enterpriseDao.add(enterprise);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Enterprise enterprise) {
|
||||
|
||||
Enterprise penterprise = enterpriseDao.get(enterprise.getpId());
|
||||
enterprise.setIdPath((penterprise != null ? penterprise.getIdPath(): "0") + "-" + String.valueOf(enterprise.getId()));
|
||||
enterpriseDao.update(enterprise);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String[] ids) {
|
||||
List<Long> ids_ = new ArrayList<Long>();
|
||||
for(String id : ids){
|
||||
try {
|
||||
ids_.add(Long.valueOf(id));
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
enterpriseDao.delete(ids_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enterprise getById(String id) {
|
||||
return enterpriseDao.get(Long.valueOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enterprise getByName(String name) {
|
||||
return enterpriseDao.get("name",name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enterprise> listAll(String state) {
|
||||
return enterpriseDao.listAll(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Enterprise> getPage(int pageNumber, int pageSize, String pId,String name,String state) {
|
||||
|
||||
Page<Enterprise> page = enterpriseDao.getPage(pageNumber, pageSize,Long.valueOf(pId),name,state);
|
||||
|
||||
if(page == null){
|
||||
page = new Page<Enterprise>();
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enterprise> listTop(Long pId) {
|
||||
return enterpriseDao.listTop(pId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enterprise> listdsub(String pId) {
|
||||
return enterpriseDao.listdsub(Long.valueOf(pId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enterprise> listdsub(String pId,String type) {
|
||||
return enterpriseDao.listdsub(Long.valueOf(pId),type);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user