Commit 8e3a73d8 by yao.xiao

增加-经纪人更新/创建自己商机信息

parent 82003a8d
......@@ -20,6 +20,7 @@ import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.*;
import com.yd.dal.entity.marketing.MktLeadsAssignedTrack;
import com.yd.dal.entity.marketing.MktLeadsAssigneds;
import com.yd.dal.entity.marketing.MktLeadsPool;
import com.yd.dal.entity.meta.MdMkCampaign;
import com.yd.dal.entity.meta.MdTag;
import com.yd.dal.entity.meta.ObjectCollectionTagged;
......@@ -29,10 +30,7 @@ import com.yd.dal.entity.survey.SurveyCustomerAnswers;
import com.yd.dal.service.customer.*;
import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService;
import com.yd.dal.service.marketing.MktLeadsAssignedsDALService;
import com.yd.dal.service.meta.MdCodeDALService;
import com.yd.dal.service.meta.MdMkCampaignDALService;
import com.yd.dal.service.meta.MdTagDALService;
import com.yd.dal.service.meta.ObjectCollectionTaggedDALService;
import com.yd.dal.service.meta.*;
import com.yd.dal.service.order.PoOrderDALService;
import com.yd.dal.service.survey.SurveyCustomerAnswersDALService;
import com.yd.dal.entity.customer.practitioner.*;
......@@ -42,8 +40,10 @@ import com.yd.rmi.tencent.wechat.vo.WeChatInfoByENV;
import com.yd.rmi.tencent.wechatinterf.pojo.ticket.TicketRequest;
import com.yd.rmi.tencent.wechatinterf.pojo.token.TokenRequest;
import com.yd.util.CommonUtil;
import com.yd.util.EncryptUtil;
import com.yd.util.HttpUtil;
import com.yd.util.config.ZHBErrorConfig;
import com.yd.util.deshandler.DESTypeHandler;
import org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
......@@ -104,7 +104,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
private AclPractitionerPotentialDALService aclPractitionerPotentialDALService;
@Autowired
private AclPractitionerPotentialAssignedTrackDALService aclPractitionerPotentialAssignedTrackDALService;
@Autowired
private MktLeadsPoolDALService mktLeadsPoolDALService;
@Override
public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) {
......@@ -549,7 +550,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds();
mktLeadsAssigneds.setCustomerId(customerId);
mktLeadsAssigneds.setAssignedPractitionerId(practitionerId);
mktLeadsAssigneds =mktLeadsAssignedsDALService.findByMktLeadsAssigneds(mktLeadsAssigneds);
List<MktLeadsAssigneds> mktLeadsAssignedsList =mktLeadsAssignedsDALService.findByMktLeadsAssigneds(mktLeadsAssigneds);
mktLeadsAssigneds = mktLeadsAssignedsList.get(0);
info.setOpportunityDate(CommonUtil.dateParseString(mktLeadsAssigneds.getCreatedAt(),"yyyy-MM-dd HH:mm:ss"));
info.setOpportunityCustomerTags(OpportunityCustomerTags(customerId));
return info;
......@@ -760,8 +762,109 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
@Override
public OwnOpportunityBasicInformationSaveResponseVO ownOpportunityBasicInformationSave(OwnOpportunityBasicInformationSaveRequestVO requestVO) {
OwnOpportunityBasicInformationSaveResponseVO resp = new OwnOpportunityBasicInformationSaveResponseVO();
Long leadsAssignedId = requestVO.getLeadsAssignedId();
Long customerId = requestVO.getOpportunityId();
if (CommonUtil.isNullOrZero(leadsAssignedId)){
//判断是否为经纪人自己创建商机
CommonResult commonResult = isCreateOpportunity(requestVO,customerId);
if (!commonResult.isSuccess()){
resp.setCommonResult(commonResult);
return resp;
}
}
//保存基础信息
saveCustomerInfo(customerId,requestVO);
//保存/激活新的标签
saveCustomerTag(customerId,requestVO.getOpportunityCustomerTags());
//更新预设值
saveLeadsAssigneds(requestVO);
resp.setOpportunityId(customerId);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return resp;
}
private CommonResult isCreateOpportunity(OwnOpportunityBasicInformationSaveRequestVO requestVO, Long customerId) {
//当指派id为null时,认为是保存新的商机
//校验商机号码,手机号码对应的customer是否存在
String mobileNo = requestVO.getMobileNo();
AclCustomer aclCustomer = aclCustomerDALService.findByMobileNo(mobileNo);
//判断是否通过手机号码找到客户
if (aclCustomer!=null){
//找到客户判断起身份,不是普通用户,则提示
Long channelReferralRateId = aclCustomer.getChannelReferralRateId();
if (channelReferralRateId != 3L){
return new CommonResult(false,"此人不是普通客户");
}
//普通用户,在查询LeadsAssigneds,看是否已被分配
MktLeadsAssigneds mktLeadsAssigneds = new MktLeadsAssigneds();
mktLeadsAssigneds.setCustomerId(aclCustomer.getId());
List<MktLeadsAssigneds> mktLeadsAssignedsList = mktLeadsAssignedsDALService.findByMktLeadsAssigneds(mktLeadsAssigneds);
if (!mktLeadsAssignedsList.isEmpty()){
return new CommonResult(false,"此客户已是其他经纪人商机");
}
}else {
//此人为第一次进来
//帮其经行注册
DESTypeHandler jpaCryptoConverter = new DESTypeHandler();
aclCustomer = new AclCustomer();
aclCustomer.setRole(2);//1= Staff 2=Customer 3=Partner
aclCustomer.setAccountId(createAccountId(mobileNo));
aclCustomer.setLogin(mobileNo);
aclCustomer.setMobileNo(jpaCryptoConverter.encode(mobileNo));
aclCustomer.setCusLevel(1);
aclCustomer.setName(requestVO.getName());
aclCustomer.setIsActive(1);
aclCustomer.setRoleId(3L);
aclCustomer.setWithdrawType(0);
aclCustomer.setCreatedAt(new Date());
aclCustomer.setCreatedBy(-1L);
aclCustomer.setUpdatedAt(new Date());
aclCustomer.setUpdatedBy(-1L);
aclCustomer.setChannelReferralRateId(3L);
aclCustomerDALService.save(aclCustomer);
}
customerId = aclCustomer.getId();
//查询此customer是否在pool中
MktLeadsPool pool = mktLeadsPoolDALService.findByCustomerId(customerId);
if (pool == null){
//线索池为空时,保存线索池
pool = new MktLeadsPool();
pool.setCustomerId(customerId);
pool.setHasAssigned(1);
pool.setSourceFrom(requestVO.getSourceFrom());
pool.setIsActive(1);
pool.setAddedAt(new Date());
pool.setAddedBy(-1L);
mktLeadsPoolDALService.save(pool);
}
//获取线索库id
Long poolId = pool.getId();
//保存至指派表
MktLeadsAssigneds assigneds = new MktLeadsAssigneds();
assigneds.setAssignedPractitionerId(requestVO.getAssignedPractitionerId());
assigneds.setCustomerId(customerId);
assigneds.setIsActive(1);
assigneds.setCreatedAt(new Date());
assigneds.setCreatedBy(-1L);
assigneds.setUpdatedAt(new Date());
assigneds.setUpdatedBy(-1L);
mktLeadsAssignedsDALService.save(assigneds);
requestVO.setLeadsAssignedId(assigneds.getId());
return new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000"));
}
private String createAccountId(String mobileNo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String sub = null;
if(mobileNo != null && !"".equals(mobileNo)){
sub = mobileNo.substring(mobileNo.length()-6);
}
return "C_"+sub+"_"+sdf.format(new Date());
}
private void saveCustomerInfo(Long customerId, OwnOpportunityBasicInformationSaveRequestVO requestVO) {
AclCustomer customer = aclCustomerDALService.findById(customerId);
customer.setName(requestVO.getName());
customer.setBirthDate(CommonUtil.stringParseDate(requestVO.getBirthDate(),"yyyy-MM-dd"));
......@@ -771,7 +874,23 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
customer.setAge(requestVO.getAge());
customer.setWechatNo(requestVO.getWeChat());
customer.setOtherContacts(requestVO.getOtherContacts());
customer.setZodiacTypeId(requestVO.getZodiacTypeId());
customer.setBloodTypeId(requestVO.getBloodTypeId());
aclCustomerDALService.save(customer);
}
private void saveLeadsAssigneds(OwnOpportunityBasicInformationSaveRequestVO requestVO) {
Long leadsAssignedId = requestVO.getLeadsAssignedId();
MktLeadsAssigneds mktLeadsAssigneds = mktLeadsAssignedsDALService.findByLeadsAssignedId(leadsAssignedId);
mktLeadsAssigneds.setFyc(requestVO.getFyc());
mktLeadsAssigneds.setFyp(requestVO.getFyp());
mktLeadsAssigneds.setPieces(requestVO.getPieces());
mktLeadsAssigneds.setTimeToClose(CommonUtil.stringParseDate(requestVO.getTimeToClose(),"yyyy-MM-dd"));
mktLeadsAssigneds.setRemark(requestVO.getRemark());
mktLeadsAssignedsDALService.updateMktLeadsAssigneds(mktLeadsAssigneds);
}
private void saveCustomerTag(Long customerId ,List<OpportunityCustomerTag> opportunityCustomerTags) {
//保存标签
//此人的原有标签全部至0
ObjectCollectionTagged tagged = new ObjectCollectionTagged();
......@@ -782,8 +901,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
tag.setIsActive(0);
objectCollectionTaggedDALService.updateObjectCollectionTagged(tag);
}
//保存/激活新的标签
List<OpportunityCustomerTag> opportunityCustomerTags = requestVO.getOpportunityCustomerTags();
for (OpportunityCustomerTag tag:opportunityCustomerTags) {
tagged = new ObjectCollectionTagged();
tagged.setTaggedObjectType(4);
......@@ -809,10 +926,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
objectCollectionTaggedDALService.updateObjectCollectionTagged(tagged);
}
}
resp.setOpportunityId(customerId);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return resp;
}
@Override
......
......@@ -2,11 +2,28 @@ package com.yd.api.practitioner.vo.opportunity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class OwnOpportunityBasicInformationSaveRequestVO {
/**
* 商机对象customerId
*/
private Long opportunityId;
/**
* 经纪人id
*/
private Long assignedPractitionerId;
/**
* 手机号码
*/
private String mobileNo;
/**
* 商机id
*/
private Long leadsAssignedId;
private String name;
private String birthDate;
private String sourceChannel;
......@@ -15,5 +32,41 @@ public class OwnOpportunityBasicInformationSaveRequestVO {
private String otherContacts;//其他类型方式
private String address;
private Long age;
/**
* 首年保费
*/
private BigDecimal fyp;
/**
* 首年佣金
*/
private BigDecimal fyc;
/**
* 预计成交时间
*/
private String timeToClose;
/**
* 线索预计件数
*/
private Integer pieces;
/**
* FK ag_md_drop_options.id 商机星座类型
*/
private Integer zodiacTypeId;
/**
* FK ag_md_drop_options.id 商机血型类型
*/
private Integer bloodTypeId;
/**
* 经纪人输入商机来源类型
*/
private Integer sourceFrom;
/**
* 备注
*/
private String remark;
private List<OpportunityCustomerTag> opportunityCustomerTags;
}
package com.yd.dal.entity.customer;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* ag_acl_customer
* @author
* Customer List 客戶
*/
@Data
public class AclCustomer implements Serializable {
public class AclCustomer {
private static final long serialVersionUID = 1L;
/**
* serial id
*/
......@@ -22,7 +21,7 @@ public class AclCustomer implements Serializable {
private Integer role;
/**
* customer# for referral use -######## = login ID
* customer# for referral use -######## = login ID
*/
private String accountId;
......@@ -68,7 +67,7 @@ public class AclCustomer implements Serializable {
private Long occupationId;
/**
* 1=普通会员 2=黄金会员 3=白金会员 4=黑金会员 5=钻石会员
* 1=普通会员 2=黄金会员 3=白金会员 4=黑金会员 5=钻石会员
*/
private Integer cusLevel;
......@@ -243,6 +242,16 @@ public class AclCustomer implements Serializable {
private String sourceChannel;
/**
* FK ag_md_drop_options.id 商机星座类型
*/
private Integer zodiacTypeId;
/**
* FK ag_md_drop_options.id 商机血型类型
*/
private Integer bloodTypeId;
/**
* 活动
*/
private String mktCampaign;
......@@ -281,6 +290,4 @@ public class AclCustomer implements Serializable {
* 年龄
*/
private Long age;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.entity.marketing;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* ag_mkt_leads_assigneds
* @author
* 商机线索指派表
*/
@Data
public class MktLeadsAssigneds implements Serializable {
public class MktLeadsAssigneds {
private static final long serialVersionUID = 1L;
/**
* serial id
*/
......@@ -42,6 +41,16 @@ public class MktLeadsAssigneds implements Serializable {
private Date timeToClose;
/**
* 线索预计件数
*/
private Integer pieces;
/**
* 备注
*/
private String remark;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
......@@ -65,6 +74,4 @@ public class MktLeadsAssigneds implements Serializable {
* 更新者 FK ag_acl_user.id
*/
private Long updatedBy;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.entity.marketing;
import java.util.Date;
import lombok.Data;
/**
* 线索添加池
*/
@Data
public class MktLeadsPool {
/**
* serial id
*/
private Long id;
/**
* 客户id
*/
private Long customerId;
/**
* 活动
*/
private String mktCampaign;
/**
* 活动任务
*/
private String mktTask;
/**
* 0=No, 1=Yes,是否已指派
*/
private Integer hasAssigned;
/**
* FK ag_md_drop_options.id 经纪人输入商机来源类型
*/
private Integer sourceFrom;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* 分析建置时间
*/
private Date addedAt;
/**
* 建置者 FK ag_acl_user.id
*/
private Long addedBy;
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomer;
import java.util.List;
import com.yd.dal.entity.customer.AclCustomer;import java.util.List;
public interface AclCustomerMapper {
int deleteByPrimaryKey(Long id);
......@@ -18,4 +16,6 @@ public interface AclCustomerMapper {
int updateByPrimaryKey(AclCustomer record);
List<AclCustomer> findByLogin(String mobileNo);
AclCustomer findByMobileNo(String mobileNo);
}
\ No newline at end of file
package com.yd.dal.mapper.marketing;
import com.yd.dal.entity.marketing.MktLeadsAssigneds;
import com.yd.dal.entity.marketing.MktLeadsAssigneds;import java.util.List;
public interface MktLeadsAssignedsMapper {
int deleteByPrimaryKey(Long id);
......@@ -15,5 +15,5 @@ public interface MktLeadsAssignedsMapper {
int updateByPrimaryKey(MktLeadsAssigneds record);
MktLeadsAssigneds findByMktLeadsAssigneds(MktLeadsAssigneds mktLeadsAssigneds);
List<MktLeadsAssigneds> findByMktLeadsAssigneds(MktLeadsAssigneds mktLeadsAssigneds);
}
\ No newline at end of file
package com.yd.dal.mapper.marketing;
import com.yd.dal.entity.marketing.MktLeadsPool;
public interface MktLeadsPoolMapper {
int deleteByPrimaryKey(Long id);
int insert(MktLeadsPool record);
int insertSelective(MktLeadsPool record);
MktLeadsPool selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(MktLeadsPool record);
int updateByPrimaryKey(MktLeadsPool record);
MktLeadsPool findByCustomerId(Long customerId);
}
\ No newline at end of file
......@@ -30,5 +30,7 @@ public interface AclCustomerDALService {
void save(AclCustomer aclCustomer);
AclCustomer findByCustomerId(Long customerId);
AclCustomer findByMobileNo(String mobileNo);
}
......@@ -3,6 +3,7 @@ package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.AclCustomer;
import com.yd.dal.mapper.customer.AclCustomerMapper;
import com.yd.dal.service.customer.AclCustomerDALService;
import com.yd.util.deshandler.DESTypeHandler;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -41,4 +42,10 @@ public class AclCustomerDALServiceImpl implements AclCustomerDALService {
return aclCustomerMapper.selectByPrimaryKey(customerId);
}
@Override
public AclCustomer findByMobileNo(String mobileNo) {
DESTypeHandler jpaCryptoConverter = new DESTypeHandler();
return aclCustomerMapper.findByMobileNo(jpaCryptoConverter.encode(mobileNo));
}
}
......@@ -6,6 +6,7 @@ import com.yd.dal.service.marketing.MktLeadsAssignedsDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("mktLeadsAssignedsDALService")
public class MktLeadsAssignedsDALServiceImpl implements MktLeadsAssignedsDALService {
......@@ -13,7 +14,22 @@ public class MktLeadsAssignedsDALServiceImpl implements MktLeadsAssignedsDALServ
private MktLeadsAssignedsMapper mktLeadsAssignedsMapper;
@Override
public MktLeadsAssigneds findByMktLeadsAssigneds(MktLeadsAssigneds mktLeadsAssigneds) {
public List<MktLeadsAssigneds> findByMktLeadsAssigneds(MktLeadsAssigneds mktLeadsAssigneds) {
return mktLeadsAssignedsMapper.findByMktLeadsAssigneds(mktLeadsAssigneds);
}
@Override
public MktLeadsAssigneds findByLeadsAssignedId(Long leadsAssignedId) {
return mktLeadsAssignedsMapper.selectByPrimaryKey(leadsAssignedId);
}
@Override
public void updateMktLeadsAssigneds(MktLeadsAssigneds mktLeadsAssigneds) {
mktLeadsAssignedsMapper.updateByPrimaryKeySelective(mktLeadsAssigneds);
}
@Override
public void save(MktLeadsAssigneds assigneds) {
mktLeadsAssignedsMapper.insertSelective(assigneds);
}
}
......@@ -2,6 +2,14 @@ package com.yd.dal.service.marketing;
import com.yd.dal.entity.marketing.MktLeadsAssigneds;
import java.util.List;
public interface MktLeadsAssignedsDALService {
MktLeadsAssigneds findByMktLeadsAssigneds(MktLeadsAssigneds mktLeadsAssigneds);
List<MktLeadsAssigneds> findByMktLeadsAssigneds(MktLeadsAssigneds mktLeadsAssigneds);
MktLeadsAssigneds findByLeadsAssignedId(Long leadsAssignedId);
void updateMktLeadsAssigneds(MktLeadsAssigneds mktLeadsAssigneds);
void save(MktLeadsAssigneds assigneds);
}
package com.yd.dal.service.meta;
import com.yd.dal.entity.marketing.MktLeadsPool;
public interface MktLeadsPoolDALService {
MktLeadsPool findByCustomerId(Long customerId);
void save(MktLeadsPool pool);
}
package com.yd.dal.service.meta.impl;
import com.yd.dal.entity.marketing.MktLeadsPool;
import com.yd.dal.mapper.marketing.MktLeadsAssignedsMapper;
import com.yd.dal.mapper.marketing.MktLeadsPoolMapper;
import com.yd.dal.service.meta.MktLeadsPoolDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service("mktLeadsPoolDALService")
public class MktLeadsPoolDALServiceImpl implements MktLeadsPoolDALService {
@Resource
private MktLeadsPoolMapper mktLeadsPoolMapper;
@Override
public MktLeadsPool findByCustomerId(Long customerId) {
return mktLeadsPoolMapper.findByCustomerId(customerId);
}
@Override
public void save(MktLeadsPool pool) {
mktLeadsPoolMapper.insertSelective(pool);
}
}
......@@ -2,6 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yd.dal.mapper.customer.AclCustomerMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomer">
<!--@mbg.generated-->
<!--@Table ag_acl_customer-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="role" jdbcType="INTEGER" property="role" />
<result column="account_id" jdbcType="VARCHAR" property="accountId" />
......@@ -30,10 +32,10 @@
<result column="referral_rate" jdbcType="DECIMAL" property="referralRate" />
<result column="referral_total_amount" jdbcType="DECIMAL" property="referralTotalAmount" />
<result column="channel_referral_rate_id" jdbcType="BIGINT" property="channelReferralRateId" />
<result column="image_path" jdbcType="VARCHAR" property="imagePath" />
<result column="image_path" jdbcType="LONGVARCHAR" property="imagePath" />
<result column="wechat_openid" jdbcType="VARCHAR" property="wechatOpenid" />
<result column="yd_wechat_openid" jdbcType="VARCHAR" property="ydWechatOpenid" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="nickname" jdbcType="LONGVARCHAR" property="nickname" />
<result column="dept_id" jdbcType="BIGINT" property="deptId" />
<result column="role_id" jdbcType="BIGINT" property="roleId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
......@@ -51,8 +53,10 @@
<result column="practitioner_id_no" jdbcType="VARCHAR" property="practitionerIdNo" />
<result column="practitioner_birthdate" jdbcType="DATE" property="practitionerBirthdate" />
<result column="practitioner_gender" jdbcType="INTEGER" property="practitionerGender" />
<result column="practitioner_portait_url" jdbcType="VARCHAR" property="practitionerPortaitUrl" />
<result column="practitioner_portait_url" jdbcType="LONGVARCHAR" property="practitionerPortaitUrl" />
<result column="source_channel" jdbcType="VARCHAR" property="sourceChannel" />
<result column="zodiac_type_id" jdbcType="INTEGER" property="zodiacTypeId" />
<result column="blood_type_id" jdbcType="INTEGER" property="bloodTypeId" />
<result column="mkt_campaign" jdbcType="VARCHAR" property="mktCampaign" />
<result column="mkt_task" jdbcType="VARCHAR" property="mktTask" />
<result column="source_plan_name" jdbcType="VARCHAR" property="sourcePlanName" />
......@@ -63,6 +67,7 @@
<result column="age" jdbcType="BIGINT" property="age" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, `role`, account_id, `login`, mobile_no, authen_code, `password`, email, province_id,
city_id, district_id, address, occupation_id, cus_level, `name`, nickname_modify,
en_firstname, en_lastname, id_type_id, id_no, gender, birth_date, last_login_time,
......@@ -71,21 +76,24 @@
created_by, updated_at, updated_by, referral_level, practitioner_reg_no, practitioner_reg_company,
practitioner_reg_expirydate, practitioner_reg_status, practitioner_reg_education_level,
practitioner_reg_name, practitioner_id_type_id, practitioner_id_no, practitioner_birthdate,
practitioner_gender, practitioner_portait_url, source_channel, mkt_campaign, mkt_task,
source_plan_name, source_publishdate, source_article, wechat_no, other_contacts,
age
practitioner_gender, practitioner_portait_url, source_channel, zodiac_type_id, blood_type_id,
mkt_campaign, mkt_task, source_plan_name, source_publishdate, source_article, wechat_no,
other_contacts, age
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from ag_acl_customer
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from ag_acl_customer
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomer" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer (`role`, account_id, `login`,
mobile_no, authen_code, `password`,
email, province_id, city_id,
......@@ -104,9 +112,10 @@
practitioner_reg_name, practitioner_id_type_id,
practitioner_id_no, practitioner_birthdate, practitioner_gender,
practitioner_portait_url, source_channel,
mkt_campaign, mkt_task, source_plan_name,
source_publishdate, source_article, wechat_no,
other_contacts, age)
zodiac_type_id, blood_type_id, mkt_campaign,
mkt_task, source_plan_name, source_publishdate,
source_article, wechat_no, other_contacts,
age)
values (#{role,jdbcType=INTEGER}, #{accountId,jdbcType=VARCHAR}, #{login,jdbcType=VARCHAR},
#{mobileNo,jdbcType=VARCHAR}, #{authenCode,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR}, #{provinceId,jdbcType=BIGINT}, #{cityId,jdbcType=BIGINT},
......@@ -116,20 +125,22 @@
#{idNo,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER}, #{birthDate,jdbcType=DATE},
#{lastLoginTime,jdbcType=TIMESTAMP}, #{isActive,jdbcType=INTEGER}, #{withdrawType,jdbcType=INTEGER},
#{referralRate,jdbcType=DECIMAL}, #{referralTotalAmount,jdbcType=DECIMAL}, #{channelReferralRateId,jdbcType=BIGINT},
#{imagePath,jdbcType=VARCHAR}, #{wechatOpenid,jdbcType=VARCHAR}, #{ydWechatOpenid,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR}, #{deptId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT},
#{imagePath,jdbcType=LONGVARCHAR}, #{wechatOpenid,jdbcType=VARCHAR}, #{ydWechatOpenid,jdbcType=VARCHAR},
#{nickname,jdbcType=LONGVARCHAR}, #{deptId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=BIGINT}, #{referralLevel,jdbcType=INTEGER}, #{practitionerRegNo,jdbcType=VARCHAR},
#{practitionerRegCompany,jdbcType=VARCHAR}, #{practitionerRegExpirydate,jdbcType=DATE},
#{practitionerRegStatus,jdbcType=INTEGER}, #{practitionerRegEducationLevel,jdbcType=INTEGER},
#{practitionerRegName,jdbcType=VARCHAR}, #{practitionerIdTypeId,jdbcType=INTEGER},
#{practitionerIdNo,jdbcType=VARCHAR}, #{practitionerBirthdate,jdbcType=DATE}, #{practitionerGender,jdbcType=INTEGER},
#{practitionerPortaitUrl,jdbcType=VARCHAR}, #{sourceChannel,jdbcType=VARCHAR},
#{mktCampaign,jdbcType=VARCHAR}, #{mktTask,jdbcType=VARCHAR}, #{sourcePlanName,jdbcType=VARCHAR},
#{sourcePublishdate,jdbcType=VARCHAR}, #{sourceArticle,jdbcType=VARCHAR}, #{wechatNo,jdbcType=VARCHAR},
#{otherContacts,jdbcType=VARCHAR}, #{age,jdbcType=BIGINT})
#{practitionerPortaitUrl,jdbcType=LONGVARCHAR}, #{sourceChannel,jdbcType=VARCHAR},
#{zodiacTypeId,jdbcType=INTEGER}, #{bloodTypeId,jdbcType=INTEGER}, #{mktCampaign,jdbcType=VARCHAR},
#{mktTask,jdbcType=VARCHAR}, #{sourcePlanName,jdbcType=VARCHAR}, #{sourcePublishdate,jdbcType=VARCHAR},
#{sourceArticle,jdbcType=VARCHAR}, #{wechatNo,jdbcType=VARCHAR}, #{otherContacts,jdbcType=VARCHAR},
#{age,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomer" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="role != null">
......@@ -282,6 +293,12 @@
<if test="sourceChannel != null">
source_channel,
</if>
<if test="zodiacTypeId != null">
zodiac_type_id,
</if>
<if test="bloodTypeId != null">
blood_type_id,
</if>
<if test="mktCampaign != null">
mkt_campaign,
</if>
......@@ -390,7 +407,7 @@
#{channelReferralRateId,jdbcType=BIGINT},
</if>
<if test="imagePath != null">
#{imagePath,jdbcType=VARCHAR},
#{imagePath,jdbcType=LONGVARCHAR},
</if>
<if test="wechatOpenid != null">
#{wechatOpenid,jdbcType=VARCHAR},
......@@ -399,7 +416,7 @@
#{ydWechatOpenid,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
#{nickname,jdbcType=VARCHAR},
#{nickname,jdbcType=LONGVARCHAR},
</if>
<if test="deptId != null">
#{deptId,jdbcType=BIGINT},
......@@ -453,11 +470,17 @@
#{practitionerGender,jdbcType=INTEGER},
</if>
<if test="practitionerPortaitUrl != null">
#{practitionerPortaitUrl,jdbcType=VARCHAR},
#{practitionerPortaitUrl,jdbcType=LONGVARCHAR},
</if>
<if test="sourceChannel != null">
#{sourceChannel,jdbcType=VARCHAR},
</if>
<if test="zodiacTypeId != null">
#{zodiacTypeId,jdbcType=INTEGER},
</if>
<if test="bloodTypeId != null">
#{bloodTypeId,jdbcType=INTEGER},
</if>
<if test="mktCampaign != null">
#{mktCampaign,jdbcType=VARCHAR},
</if>
......@@ -485,6 +508,7 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomer">
<!--@mbg.generated-->
update ag_acl_customer
<set>
<if test="role != null">
......@@ -569,7 +593,7 @@
channel_referral_rate_id = #{channelReferralRateId,jdbcType=BIGINT},
</if>
<if test="imagePath != null">
image_path = #{imagePath,jdbcType=VARCHAR},
image_path = #{imagePath,jdbcType=LONGVARCHAR},
</if>
<if test="wechatOpenid != null">
wechat_openid = #{wechatOpenid,jdbcType=VARCHAR},
......@@ -578,7 +602,7 @@
yd_wechat_openid = #{ydWechatOpenid,jdbcType=VARCHAR},
</if>
<if test="nickname != null">
nickname = #{nickname,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=LONGVARCHAR},
</if>
<if test="deptId != null">
dept_id = #{deptId,jdbcType=BIGINT},
......@@ -632,11 +656,17 @@
practitioner_gender = #{practitionerGender,jdbcType=INTEGER},
</if>
<if test="practitionerPortaitUrl != null">
practitioner_portait_url = #{practitionerPortaitUrl,jdbcType=VARCHAR},
practitioner_portait_url = #{practitionerPortaitUrl,jdbcType=LONGVARCHAR},
</if>
<if test="sourceChannel != null">
source_channel = #{sourceChannel,jdbcType=VARCHAR},
</if>
<if test="zodiacTypeId != null">
zodiac_type_id = #{zodiacTypeId,jdbcType=INTEGER},
</if>
<if test="bloodTypeId != null">
blood_type_id = #{bloodTypeId,jdbcType=INTEGER},
</if>
<if test="mktCampaign != null">
mkt_campaign = #{mktCampaign,jdbcType=VARCHAR},
</if>
......@@ -665,6 +695,7 @@
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomer">
<!--@mbg.generated-->
update ag_acl_customer
set `role` = #{role,jdbcType=INTEGER},
account_id = #{accountId,jdbcType=VARCHAR},
......@@ -693,10 +724,10 @@
referral_rate = #{referralRate,jdbcType=DECIMAL},
referral_total_amount = #{referralTotalAmount,jdbcType=DECIMAL},
channel_referral_rate_id = #{channelReferralRateId,jdbcType=BIGINT},
image_path = #{imagePath,jdbcType=VARCHAR},
image_path = #{imagePath,jdbcType=LONGVARCHAR},
wechat_openid = #{wechatOpenid,jdbcType=VARCHAR},
yd_wechat_openid = #{ydWechatOpenid,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=LONGVARCHAR},
dept_id = #{deptId,jdbcType=BIGINT},
role_id = #{roleId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
......@@ -714,8 +745,10 @@
practitioner_id_no = #{practitionerIdNo,jdbcType=VARCHAR},
practitioner_birthdate = #{practitionerBirthdate,jdbcType=DATE},
practitioner_gender = #{practitionerGender,jdbcType=INTEGER},
practitioner_portait_url = #{practitionerPortaitUrl,jdbcType=VARCHAR},
practitioner_portait_url = #{practitionerPortaitUrl,jdbcType=LONGVARCHAR},
source_channel = #{sourceChannel,jdbcType=VARCHAR},
zodiac_type_id = #{zodiacTypeId,jdbcType=INTEGER},
blood_type_id = #{bloodTypeId,jdbcType=INTEGER},
mkt_campaign = #{mktCampaign,jdbcType=VARCHAR},
mkt_task = #{mktTask,jdbcType=VARCHAR},
source_plan_name = #{sourcePlanName,jdbcType=VARCHAR},
......@@ -726,10 +759,16 @@
age = #{age,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findByLogin" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer
where login = #{mobileNo,jdbcType=VARCHAR}
</select>
<select id="findByLogin" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer
where login = #{mobileNo,jdbcType=VARCHAR}
</select>
<select id="findByMobileNo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer
where mobile_no = #{mobileNo,jdbcType=VARCHAR}
</select>
</mapper>
\ No newline at end of file
......@@ -28,6 +28,6 @@
<if test="mdDropOptionId != null">
and t.md_drop_option_id = #{mdDropOptionId,jdbcType=BIGINT}
</if>
ORDER BY t.created_at DESC
ORDER BY t.seq DESC ,t.created_at DESC
</select>
</mapper>
\ No newline at end of file
......@@ -8,6 +8,7 @@
<result column="FYP" jdbcType="DECIMAL" property="fyp" />
<result column="FYC" jdbcType="DECIMAL" property="fyc" />
<result column="time_to_close" jdbcType="TIMESTAMP" property="timeToClose" />
<result column="pieces" jdbcType="BIGINT" property="pieces" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
......@@ -16,7 +17,7 @@
</resultMap>
<sql id="Base_Column_List">
id, assigned_practitioner_id, customer_id, FYP, FYC, time_to_close, is_active, created_at,
created_by, updated_at, updated_by
created_by, updated_at, updated_by,pieces
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
......@@ -32,11 +33,11 @@
insert into ag_mkt_leads_assigneds (assigned_practitioner_id, customer_id,
FYP, FYC, time_to_close,
is_active, created_at, created_by,
updated_at, updated_by)
updated_at, updated_by,pieces)
values (#{assignedPractitionerId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT},
#{fyp,jdbcType=DECIMAL}, #{fyc,jdbcType=DECIMAL}, #{timeToClose,jdbcType=TIMESTAMP},
#{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT})
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT},#{pieces,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.marketing.MktLeadsAssigneds" useGeneratedKeys="true">
insert into ag_mkt_leads_assigneds
......@@ -71,6 +72,9 @@
<if test="updatedBy != null">
updated_by,
</if>
<if test="pieces!=null">
pieces,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="assignedPractitionerId != null">
......@@ -103,6 +107,9 @@
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
<if test="pieces != null">
#{pieces,jdbcType=INTEGER}
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.marketing.MktLeadsAssigneds">
......@@ -138,6 +145,9 @@
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
<if test="pieces != null">
pieces = #{pieces,jdbcType=INTEGER}
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -152,7 +162,8 @@
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
updated_by = #{updatedBy,jdbcType=BIGINT},
pieces = #{pieces,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findByMktLeadsAssigneds" resultMap="BaseResultMap">
......@@ -193,6 +204,9 @@
<if test="updatedBy != null">
and updated_by = #{updatedBy,jdbcType=BIGINT}
</if>
<if test="pieces != null">
and pieces = #{pieces,jdbcType=INTEGER}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<?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.yd.dal.mapper.marketing.MktLeadsPoolMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.marketing.MktLeadsPool">
<!--@mbg.generated-->
<!--@Table ag_mkt_leads_pool-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="customer_id" jdbcType="BIGINT" property="customerId" />
<result column="mkt_campaign" jdbcType="VARCHAR" property="mktCampaign" />
<result column="mkt_task" jdbcType="VARCHAR" property="mktTask" />
<result column="has_assigned" jdbcType="INTEGER" property="hasAssigned" />
<result column="source_from" jdbcType="INTEGER" property="sourceFrom" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="added_at" jdbcType="TIMESTAMP" property="addedAt" />
<result column="added_by" jdbcType="BIGINT" property="addedBy" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, customer_id, mkt_campaign, mkt_task, has_assigned, source_from, is_active,
added_at, added_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from ag_mkt_leads_pool
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from ag_mkt_leads_pool
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.marketing.MktLeadsPool" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_mkt_leads_pool (customer_id, mkt_campaign, mkt_task,
has_assigned, source_from,
is_active, added_at, added_by
)
values (#{customerId,jdbcType=BIGINT}, #{mktCampaign,jdbcType=VARCHAR}, #{mktTask,jdbcType=VARCHAR},
#{hasAssigned,jdbcType=INTEGER}, #{sourceFrom,jdbcType=INTEGER},
#{isActive,jdbcType=INTEGER}, #{addedAt,jdbcType=TIMESTAMP}, #{addedBy,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.marketing.MktLeadsPool" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_mkt_leads_pool
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">
customer_id,
</if>
<if test="mktCampaign != null">
mkt_campaign,
</if>
<if test="mktTask != null">
mkt_task,
</if>
<if test="hasAssigned != null">
has_assigned,
</if>
<if test="sourceFrom != null">
source_from,
</if>
<if test="isActive != null">
is_active,
</if>
<if test="addedAt != null">
added_at,
</if>
<if test="addedBy != null">
added_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">
#{customerId,jdbcType=BIGINT},
</if>
<if test="mktCampaign != null">
#{mktCampaign,jdbcType=VARCHAR},
</if>
<if test="mktTask != null">
#{mktTask,jdbcType=VARCHAR},
</if>
<if test="hasAssigned != null">
#{hasAssigned,jdbcType=INTEGER},
</if>
<if test="sourceFrom != null">
#{sourceFrom,jdbcType=INTEGER},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
<if test="addedAt != null">
#{addedAt,jdbcType=TIMESTAMP},
</if>
<if test="addedBy != null">
#{addedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.marketing.MktLeadsPool">
<!--@mbg.generated-->
update ag_mkt_leads_pool
<set>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=BIGINT},
</if>
<if test="mktCampaign != null">
mkt_campaign = #{mktCampaign,jdbcType=VARCHAR},
</if>
<if test="mktTask != null">
mkt_task = #{mktTask,jdbcType=VARCHAR},
</if>
<if test="hasAssigned != null">
has_assigned = #{hasAssigned,jdbcType=INTEGER},
</if>
<if test="sourceFrom != null">
source_from = #{sourceFrom,jdbcType=INTEGER},
</if>
<if test="isActive != null">
is_active = #{isActive,jdbcType=INTEGER},
</if>
<if test="addedAt != null">
added_at = #{addedAt,jdbcType=TIMESTAMP},
</if>
<if test="addedBy != null">
added_by = #{addedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.marketing.MktLeadsPool">
<!--@mbg.generated-->
update ag_mkt_leads_pool
set customer_id = #{customerId,jdbcType=BIGINT},
mkt_campaign = #{mktCampaign,jdbcType=VARCHAR},
mkt_task = #{mktTask,jdbcType=VARCHAR},
has_assigned = #{hasAssigned,jdbcType=INTEGER},
source_from = #{sourceFrom,jdbcType=INTEGER},
is_active = #{isActive,jdbcType=INTEGER},
added_at = #{addedAt,jdbcType=TIMESTAMP},
added_by = #{addedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findByCustomerId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_mkt_leads_pool
where customer_id = #{customerId,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment