26 changed files with 678 additions and 13 deletions
			
			
		| @ -0,0 +1,46 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.epmet.dao.crm; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.entity.crm.CustomerEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| 
 | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 客户表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2020-03-11 | |||
|  */ | |||
| @Mapper | |||
| public interface CustomerDao extends BaseDao<CustomerEntity> { | |||
| 
 | |||
|     /** | |||
|      * 根据创建时间起止查询有效客户列表 | |||
|      * @param createTimeFrom | |||
|      * @param createTimeTo | |||
|      * @return | |||
|      */ | |||
|     List<CustomerEntity> listValidCustomersByCreateTime( | |||
|             @Param("createTimeFrom") Date createTimeFrom, | |||
|             @Param("createTimeTo") Date createTimeTo); | |||
| } | |||
| @ -0,0 +1,41 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.epmet.dao.org; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.entity.org.CustomerDepartmentEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| 
 | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 客户部门表   | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2020-04-20 | |||
|  */ | |||
| @Mapper | |||
| public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity> { | |||
| 
 | |||
|     List<CustomerDepartmentEntity> listDepartmentsByCreatedTime( | |||
|             @Param("createdTimeFrom") Date createdTimeFrom, | |||
|             @Param("createdTimeTo") Date createdTimeTo); | |||
| 
 | |||
| } | |||
| @ -0,0 +1,91 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.epmet.entity.crm; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| 
 | |||
| import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 客户表  | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2020-03-11 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("customer") | |||
| public class CustomerEntity extends BaseEpmetEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 客户名称 | |||
|      */ | |||
| 	private String customerName; | |||
| 
 | |||
|     /** | |||
|      * 产品标题 显示在产品顶端的标题 | |||
|      */ | |||
| 	private String title; | |||
| 
 | |||
|     /** | |||
|      * 组织机构代码 | |||
|      */ | |||
| 	private String organizationNumber; | |||
| 
 | |||
|     /** | |||
|      * 组织机构代码证图片 | |||
|      */ | |||
| 	private String organizationImg; | |||
| 
 | |||
|     /** | |||
|      * 有效期 | |||
|      */ | |||
| 	private Date validityTime; | |||
| 
 | |||
|     /** | |||
|      * 客户管理员 | |||
|      */ | |||
| 	private String customerAdmin; | |||
| 
 | |||
|     /** | |||
|      * 密码 加密存储 | |||
|      */ | |||
| 	private String customerPassword; | |||
| 
 | |||
| 	/** | |||
| 	 * 客户组织级别:机关级别 | |||
| 	 * (社区级:community, | |||
| 	 * 乡(镇、街道)级:street, | |||
| 	 * 区县级: district, | |||
| 	 * 市级: city | |||
| 	 * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) | |||
| 	 */ | |||
| 	private String organizationLevel; | |||
| 
 | |||
| 	/** | |||
| 	 * 客户logo | |||
| 	 */ | |||
| 	private String logo; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,63 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * This program is free software: you can redistribute it and/or modify | |||
|  * it under the terms of the GNU General Public License as published by | |||
|  * the Free Software Foundation, either version 3 of the License, or | |||
|  * (at your option) any later version. | |||
|  * <p> | |||
|  * This program is distributed in the hope that it will be useful, | |||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
|  * GNU General Public License for more details. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| package com.epmet.entity.org; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| /** | |||
|  * 客户部门表   | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2020-04-20 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("customer_department") | |||
| public class CustomerDepartmentEntity extends BaseEpmetEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 客户ID | |||
|      */ | |||
| 	private String customerId; | |||
| 
 | |||
|     /** | |||
|      * 所属组织机构ID(customer_agency.id) | |||
|      */ | |||
| 	private String agencyId; | |||
| 
 | |||
|     /** | |||
|      * 部门名称 | |||
|      */ | |||
| 	private String departmentName; | |||
| 
 | |||
|     /** | |||
|      * 部门职责 | |||
|      */ | |||
| 	private String departmentDuty; | |||
| 
 | |||
|     /** | |||
|      * 总人数 | |||
|      */ | |||
| 	private Integer totalUser; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,12 @@ | |||
| package com.epmet.service.crm; | |||
| 
 | |||
| import com.epmet.entity.crm.CustomerEntity; | |||
| 
 | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| 
 | |||
| public interface CustomerService { | |||
| 
 | |||
|     List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo); | |||
| 
 | |||
| } | |||
| @ -0,0 +1,25 @@ | |||
| package com.epmet.service.crm.impl; | |||
| 
 | |||
| import com.epmet.commons.dynamic.datasource.annotation.DataSource; | |||
| import com.epmet.constant.DataSourceConstant; | |||
| import com.epmet.dao.crm.CustomerDao; | |||
| import com.epmet.entity.crm.CustomerEntity; | |||
| import com.epmet.service.crm.CustomerService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| 
 | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| 
 | |||
| @Service | |||
| @DataSource(DataSourceConstant.OPER_CRM) | |||
| public class CustomerServiceImpl implements CustomerService { | |||
| 
 | |||
|     @Autowired | |||
|     private CustomerDao customerDao; | |||
| 
 | |||
|     @Override | |||
|     public List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) { | |||
|         return customerDao.listValidCustomersByCreateTime(createTimeFrom, createTimeTo); | |||
|     } | |||
| } | |||
| @ -0,0 +1,11 @@ | |||
| package com.epmet.service.org; | |||
| 
 | |||
| import com.epmet.entity.org.CustomerDepartmentEntity; | |||
| 
 | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| 
 | |||
| public interface CustomerDepartmentService { | |||
| 
 | |||
|     List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo); | |||
| } | |||
| @ -0,0 +1,31 @@ | |||
| package com.epmet.service.org.impl; | |||
| 
 | |||
| import com.epmet.commons.dynamic.datasource.annotation.DataSource; | |||
| import com.epmet.constant.DataSourceConstant; | |||
| import com.epmet.dao.org.CustomerDepartmentDao; | |||
| import com.epmet.entity.org.CustomerDepartmentEntity; | |||
| import com.epmet.service.org.CustomerDepartmentService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| 
 | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| 
 | |||
| @Service | |||
| @DataSource(DataSourceConstant.GOV_ORG) | |||
| public class CustomerDepartmentServiceImpl implements CustomerDepartmentService { | |||
| 
 | |||
|     @Autowired | |||
|     private CustomerDepartmentDao departmentDao; | |||
| 
 | |||
|     /** | |||
|      * 根据创建时间查询部门列表 | |||
|      * @param createdTimeFrom | |||
|      * @param createdTimeTo | |||
|      * @return | |||
|      */ | |||
|     @Override | |||
|     public List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) { | |||
|         return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo); | |||
|     } | |||
| } | |||
| @ -0,0 +1,44 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| 
 | |||
| <mapper namespace="com.epmet.dao.crm.CustomerDao"> | |||
| 
 | |||
|     <resultMap type="com.epmet.entity.crm.CustomerEntity" id="customerMap"> | |||
|         <result property="id" column="ID"/> | |||
|         <result property="customerName" column="CUSTOMER_NAME"/> | |||
|         <result property="title" column="TITLE"/> | |||
|         <result property="organizationNumber" column="ORGANIZATION_NUMBER"/> | |||
|         <result property="organizationImg" column="ORGANIZATION_IMG"/> | |||
|         <result property="validityTime" column="VALIDITY_TIME"/> | |||
|         <result property="customerAdmin" column="CUSTOMER_ADMIN"/> | |||
|         <result property="customerPassword" column="CUSTOMER_PASSWORD"/> | |||
|         <result property="organizationLevel" column="ORGANIZATION_LEVEL"/> | |||
|         <result property="logo" column="LOGO"/> | |||
|         <result property="delFlag" column="DEL_FLAG"/> | |||
|         <result property="revision" column="REVISION"/> | |||
|         <result property="createdBy" column="CREATED_BY"/> | |||
|         <result property="createdTime" column="CREATED_TIME"/> | |||
|         <result property="updatedBy" column="UPDATED_BY"/> | |||
|         <result property="updatedTime" column="UPDATED_TIME"/> | |||
|     </resultMap> | |||
| 
 | |||
|     <!--根据创建时间起止查询有效客户列表--> | |||
|     <select id="listValidCustomersByCreateTime" resultType="com.epmet.entity.crm.CustomerEntity"> | |||
|         SELECT c.* | |||
|         FROM | |||
|             customer c | |||
|         <where> | |||
|             c.DEL_FLAG = '0' | |||
|             AND c.VALIDITY_TIME > NOW() | |||
|             <if test="createTimeFrom != null"> | |||
|                 AND c.CREATED_TIME >= #{createTimeFrom} | |||
|             </if> | |||
|             <if test="createTimeTo != null"> | |||
|                 AND c.CREATED_TIME < #{createTimeTo} | |||
|             </if> | |||
|         </where> | |||
|         ORDER BY | |||
|             CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC | |||
|     </select> | |||
| 
 | |||
| </mapper> | |||
| @ -0,0 +1,19 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| 
 | |||
| <mapper namespace="com.epmet.dao.org.CustomerDepartmentDao"> | |||
| 
 | |||
|     <select id="listDepartmentsByCreatedTime" resultType="com.epmet.entity.org.CustomerDepartmentEntity"> | |||
|         SELECT * | |||
|         FROM customer_department | |||
|         <where> | |||
|             DEL_FLAG = 0 | |||
|             <if test="createdTimeFrom != null"> | |||
|                 AND CREATED_TIME >= #{createdTimeFrom} | |||
|             </if> | |||
|             <if test="createdTimeTo != null"> | |||
|                 AND CREATED_TIME < #{createdTimeTo} | |||
|             </if> | |||
|         </where> | |||
|     </select> | |||
| </mapper> | |||
					Loading…
					
					
				
		Reference in new issue