Commit 0fb42ce1 by Water Wang

optimzie-practitioenr login

parent aba3fe5a
......@@ -3,6 +3,7 @@ package com.yd.api.customer.service;
import java.util.ArrayList;
import java.util.List;
import com.yd.dal.service.customer.CustomerDALService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -16,13 +17,12 @@ import com.yd.api.customer.vo.CustomerVO;
import com.yd.dal.entity.customer.Customer;
import com.yd.dal.entity.customer.CustomerFortune;
import com.yd.dal.mapper.customer.CustomerFortuneMapper;
import com.yd.dal.service.customer.CustomerDA;
@Service("customerServiceImpl")
public class CustomerServiceImpl implements CustomerService{
@Autowired
private CustomerDA customerServiceDA;
private CustomerDALService customerServiceDA;
@Autowired
private CustomerFortuneMapper customerFortuneMapper;
......
package com.yd.api.practitioner;
import com.yd.api.practitioner.service.PractitionerService;
import com.yd.api.practitioner.vo.login.PractitionerLoginRequestVO;
import com.yd.api.practitioner.vo.login.PractitionerLoginResponseVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.result.JsonResult;
......@@ -18,7 +20,21 @@ public class PractitionerController {
private PractitionerService practitionerService;
/**
* 线下经纪人排行榜
* 经纪人登录
* @param requestVO
* @return
*/
@RequestMapping("/practitionerLogin")
public Object practitionerLogin(@RequestBody PractitionerLoginRequestVO requestVO){
JsonResult result = new JsonResult();
PractitionerLoginResponseVO responseVO = practitionerService.practitionerLogin(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
}
/**
* 经纪人(排行榜) + (保费+佣金+件数)查询
* @param requestVO
* @return Object
*/
......
package com.yd.api.practitioner.service;
import com.yd.api.practitioner.vo.login.PractitionerLoginRequestVO;
import com.yd.api.practitioner.vo.login.PractitionerLoginResponseVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import org.springframework.stereotype.Service;
@Service("practitionerService")
public interface PractitionerService {
/**
* 经纪人登录接口
* @param requestVO 请求信息
* @return PractitionerLoginResponseVO
*/
PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO);
/**
* 线下经纪人排行榜查询
* @param requestVO
* @return
* 经纪人排行榜查询
* @param requestVO 请求信息
* @return PractitionerRankResponseVO
*/
PractitionerRankResponseVO practitionerRank(PractitionerRankRequestVO requestVO);
}
package com.yd.api.practitioner.service.impl;
import com.yd.api.practitioner.vo.login.PractitionerBasicInfo;
import com.yd.api.practitioner.vo.login.PractitionerLoginRequestVO;
import com.yd.api.practitioner.vo.login.PractitionerLoginResponseVO;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;
import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.rank.PractitionerInfoForAchievement;
import com.yd.api.result.CommonResult;
import com.yd.dal.entity.practitioner.PractitionerBasicInfo;
import com.yd.dal.entity.customer.AclCustomerLog;
import com.yd.dal.entity.customer.CustomerFileUpload;
import com.yd.dal.entity.practitioner.PractitionerBasicInfoDAL;
import com.yd.dal.entity.practitioner.PractitionerInfo;
import com.yd.dal.entity.practitioner.PractitionerRankInfo;
import com.yd.dal.entity.practitioner.PractitionerSubordinateInfo;
import com.yd.dal.service.customer.AclCustomerLogDALService;
import com.yd.dal.service.customer.AclFileUploadDALService;
import com.yd.dal.service.meta.MdCodeDALService;
import com.yd.dal.service.practitioner.PractitionerDALService;
import com.yd.dal.service.practitioner.PractitionerSubordinateDALService;
import com.yd.util.config.ZHBErrorConfig;
import com.yd.util.deshandler.DESTypeHandler;
import org.springframework.beans.BeanUtils;
......@@ -28,6 +38,71 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
private PractitionerDALService practitionerDALService;
@Autowired
private MdCodeDALService mdCodeDALService;
@Autowired
private AclFileUploadDALService aclFileUploadDALService;
@Autowired
private PractitionerSubordinateDALService practitionerSubordinateDALService;
@Autowired
private AclCustomerLogDALService aclCustomerLogDALService;
@Override
public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) {
PractitionerLoginResponseVO responseVO = new PractitionerLoginResponseVO();
String mobileNo = requestVO.getMobileNo();
//1、校验入参,电话号码不能为空
if (Strings.isNullOrEmpty(mobileNo)) {
String[] params = {"mobileNo"};
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("610001", params)));
return responseVO;
}
//2、检查是否在ag_acl_customer表中存在该用户,如果不存在就注册,然后直接抛错,该用户未注册为经纪人
PractitionerInfo practitionerInfo = practitionerDALService.findPractitionerInfoByLogin(mobileNo);
if(practitionerInfo != null){
Long practitionerType = practitionerInfo.getPractitionerType();
//处理特殊人员
boolean isSpecial = false;
String mobileSpecialStr = mdCodeDALService.findCodeByType("special_practitioner_mobile");
if(!Strings.isNullOrEmpty(mobileSpecialStr)){
List<String> mobileSpecials = Arrays.asList(mobileSpecialStr.split(","));
isSpecial = mobileSpecials.contains(mobileNo);
}
if(28L == practitionerType || isSpecial){//只有寿险的经纪人和注册为经纪人的员工才能登录
Long practitionerId = practitionerInfo.getPractitionerId();
Long customerId = practitionerInfo.getCustomerId();
PractitionerBasicInfo basicInfo = new PractitionerBasicInfo();
BeanUtils.copyProperties(practitionerInfo,basicInfo);
//获取头像
Integer targetType = 1, targetUseFor = 1;
CustomerFileUpload fileUpload = aclFileUploadDALService.findFilePathInfo(targetType,targetUseFor,practitionerId);
String imagePath = (fileUpload != null) ? fileUpload.getFilePath() : null;
basicInfo.setHeadImagePath(imagePath);
//获取体系信息
Long subordinateId = practitionerInfo.getSubordinateId();
if(subordinateId != null){
PractitionerSubordinateInfo subordinateInfo = practitionerSubordinateDALService.findSubordinateInfo(subordinateId);
if(subordinateInfo != null){
basicInfo.setSubordinateName(subordinateInfo.getSubordinateName());
basicInfo.setSubordinateLeader(subordinateInfo.getSubordinateLeader());
}
}
//获取用户的登录次数
List<AclCustomerLog> customerLogList = aclCustomerLogDALService.findLogInfoByCustomerId(customerId);
int logTimes = (customerLogList.isEmpty()) ? 0 : customerLogList.size();
//保存用户的登录记录
aclCustomerLogDALService.saveCustomerLog(customerId,2);
responseVO.setCustomerId(customerId);
responseVO.setPractitionerId(practitionerId);
responseVO.setPractitionerBasicInfo(basicInfo);
responseVO.setLoginTimes(logTimes);
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
}
}else{
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("830001")));
}
return responseVO;
}
@Override
public PractitionerRankResponseVO practitionerRank(PractitionerRankRequestVO requestVO) {
PractitionerRankResponseVO responseVO = new PractitionerRankResponseVO();
......@@ -40,7 +115,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
platform = (platform == null) ? 1 : platform;
if(!Strings.isNullOrEmpty(mobileNo)){
//查询该手机号码的经纪人id,是否存在
PractitionerBasicInfo practitionerBasicInfo = getPractitionerBasicInfo(mobileNo,platform);
PractitionerBasicInfoDAL practitionerBasicInfo = getPractitionerBasicInfo(mobileNo,platform);
if(practitionerBasicInfo != null){
String practitionerId = practitionerBasicInfo.getPractitionerId();
if(!Strings.isNullOrEmpty(practitionerId)){
......@@ -50,7 +125,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
}
}else{
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("820001"))); //该经纪人不存在
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("830001"))); //该经纪人不存在
}
}else{
String [] param = {"mobileNo"};
......@@ -77,8 +152,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return rankInfoList;
}
private PractitionerBasicInfo getPractitionerBasicInfo(String mobileNo, Integer platform) {
PractitionerBasicInfo practitionerBasicInfo;
private PractitionerBasicInfoDAL getPractitionerBasicInfo(String mobileNo, Integer platform) {
PractitionerBasicInfoDAL practitionerBasicInfo;
if(platform == 1){
DESTypeHandler jpaCryptoConverter = new DESTypeHandler();
mobileNo = jpaCryptoConverter.encode(mobileNo);
......
package com.yd.api.practitioner.vo.login;
public class PractitionerBasicInfo {
private String name;//姓名
private String headImagePath;//头像
private String levelCode;//级别code
private String levelName;//级别
private String insurerBranchName;//分公司名称
private String subordinateName;//体系名
private String subordinateLeader;//团队长
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getHeadImagePath() {
return headImagePath;
}
public void setHeadImagePath(String headImagePath) {
this.headImagePath = headImagePath;
}
public String getLevelName() {
return levelName;
}
public void setLevelName(String levelName) {
this.levelName = levelName;
}
public String getSubordinateName() {
return subordinateName;
}
public void setSubordinateName(String subordinateName) {
this.subordinateName = subordinateName;
}
public String getLevelCode() {
return levelCode;
}
public void setLevelCode(String levelCode) {
this.levelCode = levelCode;
}
public String getInsurerBranchName() {
return insurerBranchName;
}
public void setInsurerBranchName(String insurerBranchName) {
this.insurerBranchName = insurerBranchName;
}
public String getSubordinateLeader() {
return subordinateLeader;
}
public void setSubordinateLeader(String subordinateLeader) {
this.subordinateLeader = subordinateLeader;
}
}
package com.yd.api.practitioner.vo.login;
public class PractitionerLoginRequestVO {
private String mobileNo;
private String name;
private String email;
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
package com.yd.api.practitioner.vo.login;
import com.yd.api.result.CommonResult;
public class PractitionerLoginResponseVO {
private Long customerId;
private Long practitionerId;
private Integer loginTimes;
private PractitionerBasicInfo practitionerBasicInfo;
private CommonResult commonResult;
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public Long getPractitionerId() {
return practitionerId;
}
public void setPractitionerId(Long practitionerId) {
this.practitionerId = practitionerId;
}
public Integer getLoginTimes() {
return loginTimes;
}
public void setLoginTimes(Integer loginTimes) {
this.loginTimes = loginTimes;
}
public PractitionerBasicInfo getPractitionerBasicInfo() {
return practitionerBasicInfo;
}
public void setPractitionerBasicInfo(PractitionerBasicInfo practitionerBasicInfo) {
this.practitionerBasicInfo = practitionerBasicInfo;
}
public CommonResult getCommonResult() {
return commonResult;
}
public void setCommonResult(CommonResult commonResult) {
this.commonResult = commonResult;
}
}
package com.yd.dal.entity.customer;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ag_acl_customer_log
* @author
*/
@Data
public class AclCustomerLog implements Serializable {
private Long id;
/**
* FK ag_acl_customer.id
*/
private Long customerId;
private String sessionId;
/**
* The IP address of client
*/
private String fromIp;
/**
* 1:銀盾在綫,2:銀盾經紀
*/
private Integer fromPlateform;
/**
* The hostname of client
*/
private String fromHostname;
private Date loginTime;
private Date logoutTime;
/**
* 1= Success 0=Fail
*/
private Integer isSuccess;
private Date createdAt;
private Long createdBy;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.entity.customer;
public class CustomerFileUpload {
private Long id;
private String fileName;
private String filePath;
private String remark;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
package com.yd.dal.entity.practitioner;
public class PractitionerBasicInfo {
public class PractitionerBasicInfoDAL {
private Long customerId;
private Long practitionerIdForOnline;
private String practitionerId;
......
package com.yd.dal.entity.practitioner;
public class PractitionerInfo {
private Long customerId;
private Long practitionerId;
private String name;//姓名
private Integer gender;
private Long practitionerType;//经纪人类型
private String levelCode;//级别code
private String levelName;//级别
private String insurerBranchName;//分公司名称
private Long subordinateId;//体系ID
private String weChatId;
private String qqId;
private String practitionerRegNo;
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public Long getPractitionerId() {
return practitionerId;
}
public void setPractitionerId(Long practitionerId) {
this.practitionerId = practitionerId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getPractitionerType() {
return practitionerType;
}
public void setPractitionerType(Long practitionerType) {
this.practitionerType = practitionerType;
}
public String getLevelCode() {
return levelCode;
}
public void setLevelCode(String levelCode) {
this.levelCode = levelCode;
}
public String getLevelName() {
return levelName;
}
public void setLevelName(String levelName) {
this.levelName = levelName;
}
public Long getSubordinateId() {
return subordinateId;
}
public void setSubordinateId(Long subordinateId) {
this.subordinateId = subordinateId;
}
public String getInsurerBranchName() {
return insurerBranchName;
}
public void setInsurerBranchName(String insurerBranchName) {
this.insurerBranchName = insurerBranchName;
}
public String getWeChatId() {
return weChatId;
}
public void setWeChatId(String weChatId) {
this.weChatId = weChatId;
}
public String getQqId() {
return qqId;
}
public void setQqId(String qqId) {
this.qqId = qqId;
}
public String getPractitionerRegNo() {
return practitionerRegNo;
}
public void setPractitionerRegNo(String practitionerRegNo) {
this.practitionerRegNo = practitionerRegNo;
}
public Integer getGender() {
return gender;
}
public void setGender(Integer gender) {
this.gender = gender;
}
}
package com.yd.dal.entity.practitioner;
public class PractitionerSubordinateInfo {
private Long subordinateId;
private String subordinateName;//体系名
private String subordinateCode;
private Long ownerId;
private String subordinateLeader;//团队长
private String contactName;
private String contactNo;
private String remark;
public Long getSubordinateId() {
return subordinateId;
}
public void setSubordinateId(Long subordinateId) {
this.subordinateId = subordinateId;
}
public String getSubordinateName() {
return subordinateName;
}
public void setSubordinateName(String subordinateName) {
this.subordinateName = subordinateName;
}
public String getSubordinateCode() {
return subordinateCode;
}
public void setSubordinateCode(String subordinateCode) {
this.subordinateCode = subordinateCode;
}
public Long getOwnerId() {
return ownerId;
}
public void setOwnerId(Long ownerId) {
this.ownerId = ownerId;
}
public String getSubordinateLeader() {
return subordinateLeader;
}
public void setSubordinateLeader(String subordinateLeader) {
this.subordinateLeader = subordinateLeader;
}
public String getContactName() {
return contactName;
}
public void setContactName(String contactName) {
this.contactName = contactName;
}
public String getContactNo() {
return contactNo;
}
public void setContactNo(String contactNo) {
this.contactNo = contactNo;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomerLog;
import java.util.List;
public interface AclCustomerLogMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerLog record);
int insertSelective(AclCustomerLog record);
AclCustomerLog selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerLog record);
int updateByPrimaryKey(AclCustomerLog record);
List<AclCustomerLog> findLogInfoByCustomerId(Long customerId);
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.CustomerFileUpload;
import org.apache.ibatis.annotations.Param;
public interface AclFileUploadMapper {
CustomerFileUpload findByTargetTypeAndTargetUseForAndTargetId(@Param("targetType") Integer targetType, @Param("targetUseFor")Integer targetUseFor, @Param("practitionerId")Long practitionerId);
}
package com.yd.dal.mapper.practitioner;
import com.yd.dal.entity.practitioner.PractitionerBasicInfo;
import com.yd.dal.entity.practitioner.PractitionerBasicInfoDAL;
import com.yd.dal.entity.practitioner.PractitionerInfo;
import com.yd.dal.entity.practitioner.PractitionerRankInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PractitionerMapper {
PractitionerBasicInfo getPractitionerInfoByMobileNoForOffline(String mobileNo);
PractitionerBasicInfoDAL getPractitionerInfoByMobileNoForOffline(String mobileNo);
List<PractitionerRankInfo> getPractitionerRankInfoForOffline(@Param("time") Integer time);
PractitionerBasicInfo getPractitionerInfoByMobileNoForOnline(String mobileNo);
PractitionerBasicInfoDAL getPractitionerInfoByMobileNoForOnline(String mobileNo);
List<PractitionerRankInfo> getPractitionerRankInfoForOnline(@Param("time")Integer time,@Param("practitionerTypeId")Long practitionerTypeId);
List<PractitionerRankInfo> getPractitionerRankInfoForSpecials(@Param("mobileSpecials") List<String> mobileSpecials, @Param("time")Integer time);
PractitionerInfo findPractitionerInfoByLogin(@Param("mobileNo")String mobileNo);
}
package com.yd.dal.mapper.practitioner;
import com.yd.dal.entity.practitioner.PractitionerSubordinateInfo;
import org.apache.ibatis.annotations.Param;
public interface PractitionerSubordinateMapper {
PractitionerSubordinateInfo findSubordinateInfo(@Param("subordinateId") Long subordinateId);
}
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclCustomerLog;
import com.yd.dal.mapper.customer.AclCustomerLogMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service("aclCustomerLogDALService")
public class AclCustomerLogDALService {
@Resource
private AclCustomerLogMapper aclCustomerLogMapper;
public List<AclCustomerLog> findLogInfoByCustomerId(Long customerId) {
List<AclCustomerLog> customerLogList = new ArrayList<>();
if(customerId != null){
customerLogList = aclCustomerLogMapper.findLogInfoByCustomerId(customerId);
}
return customerLogList;
}
/**
* 保存用户日志
* @param customerId 用户id
* @param plateFlag 1-在线平台 2-经纪
*/
public void saveCustomerLog(Long customerId, int plateFlag) {
AclCustomerLog customerLog = new AclCustomerLog();
customerLog.setCustomerId(customerId);
customerLog.setFromPlateform(plateFlag);
customerLog.setLoginTime(new Date());
customerLog.setIsSuccess(1);
customerLog.setCreatedAt(new Date());
customerLog.setCreatedBy(-1L);
aclCustomerLogMapper.insert(customerLog);
}
}
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.CustomerFileUpload;
import org.springframework.stereotype.Service;
@Service("aclFileUploadDALService")
public interface AclFileUploadDALService {
/**
* 通过ag_acl_file_upload查询用户的头像
* @param targetType 1.经纪人,2.员工,3.客户表,4.渠道表
* @param targetUseFor 1、头像,2、生活照,3、证照,4、毕业证书,5、营业登记证,6、质询定制方案,7、身份证正面,8、身份证方面
* @param practitionerId 经纪人Id
* @return 查询结果
*/
CustomerFileUpload findFilePathInfo(Integer targetType, Integer targetUseFor, Long practitionerId);
}
......@@ -10,7 +10,7 @@ import com.yd.dal.entity.customer.CustomerFortune;
* @author Simon
* @version 1.0
*/
public interface CustomerDA {
public interface CustomerDALService {
List<Customer> listAllCustomers();
......
package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.CustomerFileUpload;
import com.yd.dal.mapper.customer.AclFileUploadMapper;
import com.yd.dal.service.customer.AclFileUploadDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service("aclFileUploadDALService")
public class AclFileUploadDALServiceImpl implements AclFileUploadDALService {
@Resource
private AclFileUploadMapper aclFileUploadMapper;
@Override
public CustomerFileUpload findFilePathInfo(Integer targetType, Integer targetUseFor, Long practitionerId) {
CustomerFileUpload fileUpload = null;
if(targetType != null && targetUseFor != null && practitionerId != null){
fileUpload = aclFileUploadMapper.findByTargetTypeAndTargetUseForAndTargetId(targetType,targetUseFor,practitionerId);
}
return fileUpload;
}
}
package com.yd.dal.service.customer;
package com.yd.dal.service.customer.impl;
import com.yd.dal.service.customer.CustomerDALService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
......@@ -22,10 +23,10 @@ import java.util.List;
* @author Simon
* @version 1.0
*/
@Service("customerDAImpl")
public class CustomerDAImpl implements CustomerDA {
@Service("customerDALService")
public class CustomerDALServiceImpl implements CustomerDALService {
private static final Logger LOG = Logger.getLogger(CustomerDAImpl.class);
private static final Logger LOG = Logger.getLogger(CustomerDALServiceImpl.class);
@Resource
private CustomerMapper customerMapper;
......
package com.yd.dal.service.practitioner;
import com.yd.dal.entity.practitioner.PractitionerBasicInfo;
import com.yd.dal.entity.practitioner.PractitionerBasicInfoDAL;
import com.yd.dal.entity.practitioner.PractitionerInfo;
import com.yd.dal.entity.practitioner.PractitionerRankInfo;
import java.util.List;
......@@ -11,13 +12,13 @@ public interface PractitionerDALService {
* @param mobileNo
* @return
*/
PractitionerBasicInfo getPractitionerBasicInfoForOffline(String mobileNo);
PractitionerBasicInfoDAL getPractitionerBasicInfoForOffline(String mobileNo);
/**
* 线上--通过手机号码获取经纪人的基础信息
* @param mobileNo
* @return
*/
PractitionerBasicInfo getPractitionerBasicInfoForOnline(String mobileNo);
PractitionerBasicInfoDAL getPractitionerBasicInfoForOnline(String mobileNo);
/**
* 线下--按照时间进行查询经纪人的排名统计信息
......@@ -39,4 +40,11 @@ public interface PractitionerDALService {
* @return
*/
List<PractitionerRankInfo> getPractitionerRankInfoForSpecials(List<String> mobileSpecials,Integer time);
/**
* 经纪人基本信息查询
* @param mobileNo
* @return
*/
PractitionerInfo findPractitionerInfoByLogin(String mobileNo);
}
package com.yd.dal.service.practitioner;
import com.yd.dal.entity.practitioner.PractitionerSubordinateInfo;
import com.yd.dal.mapper.practitioner.PractitionerSubordinateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("practitionerSubordinateDALService")
public class PractitionerSubordinateDALService {
@Autowired
private PractitionerSubordinateMapper practitionerSubordinateMapper;
/**
* 根据体系ID获取体系相关信息
* @param subordinateId 体系ID
* @return
*/
public PractitionerSubordinateInfo findSubordinateInfo(Long subordinateId) {
PractitionerSubordinateInfo subordinateInfo = null;
if(subordinateId != null){
subordinateInfo = practitionerSubordinateMapper.findSubordinateInfo(subordinateId);
}
return subordinateInfo;
}
}
package com.yd.dal.service.practitioner.impl;
import com.google.common.base.Strings;
import com.yd.dal.entity.practitioner.PractitionerBasicInfo;
import com.yd.dal.entity.practitioner.PractitionerBasicInfoDAL;
import com.yd.dal.entity.practitioner.PractitionerInfo;
import com.yd.dal.entity.practitioner.PractitionerRankInfo;
import com.yd.dal.mapper.practitioner.PractitionerMapper;
import com.yd.dal.service.customer.CustomerDAImpl;
import com.yd.dal.service.customer.impl.CustomerDALServiceImpl;
import com.yd.dal.service.practitioner.PractitionerDALService;
import com.yd.util.intercept.annotation.TargetDataSource;
import com.yd.util.intercept.commons.DataSourceKey;
......@@ -16,12 +17,12 @@ import java.util.List;
@Service("practitionerServiceDAL")
public class PractitionerDALServiceImpl implements PractitionerDALService {
private static final Logger LOG = Logger.getLogger(CustomerDAImpl.class);
private static final Logger LOG = Logger.getLogger(CustomerDALServiceImpl.class);
@Resource
private PractitionerMapper practitionerMapper;
@Override
@TargetDataSource(dataSourceKey = DataSourceKey.DB_EGOLDEN)
public PractitionerBasicInfo getPractitionerBasicInfoForOffline(String mobileNo) {
public PractitionerBasicInfoDAL getPractitionerBasicInfoForOffline(String mobileNo) {
if(!Strings.isNullOrEmpty(mobileNo)){
return practitionerMapper.getPractitionerInfoByMobileNoForOffline(mobileNo);
}else{
......@@ -31,7 +32,7 @@ public class PractitionerDALServiceImpl implements PractitionerDALService {
}
@Override
public PractitionerBasicInfo getPractitionerBasicInfoForOnline(String mobileNo) {
public PractitionerBasicInfoDAL getPractitionerBasicInfoForOnline(String mobileNo) {
if(!Strings.isNullOrEmpty(mobileNo)){
return practitionerMapper.getPractitionerInfoByMobileNoForOnline(mobileNo);
}else{
......@@ -55,4 +56,9 @@ public class PractitionerDALServiceImpl implements PractitionerDALService {
public List<PractitionerRankInfo> getPractitionerRankInfoForSpecials(List<String> mobileSpecials,Integer time) {
return practitionerMapper.getPractitionerRankInfoForSpecials(mobileSpecials,time);
}
@Override
public PractitionerInfo findPractitionerInfoByLogin(String mobileNo) {
return practitionerMapper.findPractitionerInfoByLogin(mobileNo);
}
}
......@@ -8,4 +8,5 @@
##系统提示信息
810001=token无效或者错误!
820001=该用户还是不是寿险经纪人。
\ No newline at end of file
830001=该用户非寿险经纪人。
830002=只有寿险经纪人才有权限进入!
\ 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.customer.AclCustomerLogMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerLog">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="customer_id" jdbcType="BIGINT" property="customerId" />
<result column="session_id" jdbcType="VARCHAR" property="sessionId" />
<result column="from_ip" jdbcType="VARCHAR" property="fromIp" />
<result column="from_plateform" jdbcType="INTEGER" property="fromPlateform" />
<result column="from_hostname" jdbcType="VARCHAR" property="fromHostname" />
<result column="login_time" jdbcType="TIMESTAMP" property="loginTime" />
<result column="logout_time" jdbcType="TIMESTAMP" property="logoutTime" />
<result column="is_success" jdbcType="INTEGER" property="isSuccess" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
</resultMap>
<sql id="Base_Column_List">
id, customer_id, session_id, from_ip, from_plateform, from_hostname, login_time,
logout_time, is_success, created_at, created_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_log
where id = #{id,jdbcType=BIGINT}
</select>
<select id="findLogInfoByCustomerId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_log
where customer_id = #{customerId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ag_acl_customer_log
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerLog" useGeneratedKeys="true">
insert into ag_acl_customer_log (customer_id, session_id, from_ip,
from_plateform, from_hostname, login_time,
logout_time, is_success, created_at,
created_by)
values (#{customerId,jdbcType=BIGINT}, #{sessionId,jdbcType=VARCHAR}, #{fromIp,jdbcType=VARCHAR},
#{fromPlateform,jdbcType=INTEGER}, #{fromHostname,jdbcType=VARCHAR}, #{loginTime,jdbcType=TIMESTAMP},
#{logoutTime,jdbcType=TIMESTAMP}, #{isSuccess,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerLog" useGeneratedKeys="true">
insert into ag_acl_customer_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">
customer_id,
</if>
<if test="sessionId != null">
session_id,
</if>
<if test="fromIp != null">
from_ip,
</if>
<if test="fromPlateform != null">
from_plateform,
</if>
<if test="fromHostname != null">
from_hostname,
</if>
<if test="loginTime != null">
login_time,
</if>
<if test="logoutTime != null">
logout_time,
</if>
<if test="isSuccess != null">
is_success,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">
#{customerId,jdbcType=BIGINT},
</if>
<if test="sessionId != null">
#{sessionId,jdbcType=VARCHAR},
</if>
<if test="fromIp != null">
#{fromIp,jdbcType=VARCHAR},
</if>
<if test="fromPlateform != null">
#{fromPlateform,jdbcType=INTEGER},
</if>
<if test="fromHostname != null">
#{fromHostname,jdbcType=VARCHAR},
</if>
<if test="loginTime != null">
#{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="logoutTime != null">
#{logoutTime,jdbcType=TIMESTAMP},
</if>
<if test="isSuccess != null">
#{isSuccess,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomerLog">
update ag_acl_customer_log
<set>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=BIGINT},
</if>
<if test="sessionId != null">
session_id = #{sessionId,jdbcType=VARCHAR},
</if>
<if test="fromIp != null">
from_ip = #{fromIp,jdbcType=VARCHAR},
</if>
<if test="fromPlateform != null">
from_plateform = #{fromPlateform,jdbcType=INTEGER},
</if>
<if test="fromHostname != null">
from_hostname = #{fromHostname,jdbcType=VARCHAR},
</if>
<if test="loginTime != null">
login_time = #{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="logoutTime != null">
logout_time = #{logoutTime,jdbcType=TIMESTAMP},
</if>
<if test="isSuccess != null">
is_success = #{isSuccess,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomerLog">
update ag_acl_customer_log
set customer_id = #{customerId,jdbcType=BIGINT},
session_id = #{sessionId,jdbcType=VARCHAR},
from_ip = #{fromIp,jdbcType=VARCHAR},
from_plateform = #{fromPlateform,jdbcType=INTEGER},
from_hostname = #{fromHostname,jdbcType=VARCHAR},
login_time = #{loginTime,jdbcType=TIMESTAMP},
logout_time = #{logoutTime,jdbcType=TIMESTAMP},
is_success = #{isSuccess,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</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.customer.AclFileUploadMapper">
<resultMap id="file_upload_map" type="com.yd.dal.entity.customer.CustomerFileUpload">
<result column="id" property="id"/>
<result column="fileName" property="fileName"/>
<result column="filePath" property="filePath"/>
<result column="remark" property="remark"/>
</resultMap>
<select id="findByTargetTypeAndTargetUseForAndTargetId" resultMap="file_upload_map">
SELECT
u.id as id,
u.file_name as fileName,
u.file_path as filePath,
u.remark as remark
FROM ag_acl_file_upload u
where u.is_active = 1
and u.target_type = #{targetType}
and u.target_use_for = #{targetUseFor}
and u.target_id = #{practitionerId}
</select>
</mapper>
<?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.practitioner.PractitionerMapper">
<resultMap id="base_result_map_practitioner_info" type="com.yd.dal.entity.practitioner.PractitionerBasicInfo">
<resultMap id="base_result_map_practitioner_info" type="com.yd.dal.entity.practitioner.PractitionerBasicInfoDAL">
<result column="customerId" property="customerId"/>
<result column="practitionerIdForOnline" property="practitionerIdForOnline"/>
<result column="practitionerId" property="practitionerId"/>
......@@ -135,6 +135,46 @@
group by p.id;
</select>
<resultMap id="practitioner_info_map" type="com.yd.dal.entity.practitioner.PractitionerInfo">
<result column="customerId" property="customerId"/>
<result column="practitionerId" property="practitionerId"/>
<result column="name" property="name"/>
<result column="gender" property="gender"/>
<result column="practitionerType" property="practitionerType" />
<result column="levelCode" property="levelCode" />
<result column="levelName" property="levelName"/>
<result column="insurerBranchName" property="insurerBranchName"/>
<result column="subordinateId" property="subordinateId"/>
<result column="subordinateName" property="subordinateName"/>
<result column="subordinateLeader" property="subordinateLeader"/>
<result column="weChatId" property="weChatId"/>
<result column="qqId" property="qqId"/>
<result column="practitionerRegNo" property="practitionerRegNo"/>
</resultMap>
<select id="findPractitionerInfoByLogin" resultMap="practitioner_info_map">
select
p.customer_id as customerId,
p.id as practitionerId,
p.name as name,
p.gender as gender,
s.practitioner_type_id as practitionerType,
o.drop_option_code as levelCode,
o.drop_option_name as levelName,
b.branch_name as insurerBranchName,
p.subordinate_system_id as subordinateId,
p.wechat_id as weChatId,
p.qq_id as qqId,
p.practitioner_reg_no as practitionerRegNo
from ag_acl_customer c inner join ag_acl_practitioner p on c.id = p.customer_id
left join ag_acl_insurer_branch b on p.insurer_branch_id = b.id
left join ag_acl_practitioner_setting s on p.id = s.practitioner_id
inner join ag_md_drop_options o on s.practitioner_level = o.id
where c.login = #{mobileNo};
</select>
</mapper>
<?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.practitioner.PractitionerSubordinateMapper">
<resultMap id="practitioner_subordinate_map" type="com.yd.dal.entity.practitioner.PractitionerSubordinateInfo">
<result column="subordinateId" property="subordinateId"/>
<result column="subordinateName" property="subordinateName"/>
<result column="subordinateCode" property="subordinateCode"/>
<result column="ownerId" property="ownerId"/>
<result column="subordinateLeader" property="subordinateLeader"/>
<result column="contactName" property="contactName"/>
<result column="contactNo" property="contactNo"/>
<result column="remark" property="remark"/>
</resultMap>
<select id="findSubordinateInfo" resultMap="practitioner_subordinate_map">
SELECT
s.id as subordinateId,
s.name as subordinateName,
s.subordinate_system_code as subordinateCode,
s.owner_practitioner_id as ownerId,
p.name as subordinateLeader,
s.contact_name as contactName,
s.contact_no as contactNo,
s.remark as remark
FROM ag_acl_practitioner_subordinate_system s left join ag_acl_practitioner p on s.owner_practitioner_id = p.id
where s.is_active = 1
and s.id = #{subordinateId}
</select>
</mapper>
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