Commit 6a1a7a38 by Water Wang

optimize

parent a148a4ea
...@@ -10,6 +10,8 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO; ...@@ -10,6 +10,8 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO; import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*; import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.setting.*; import com.yd.api.practitioner.vo.setting.*;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryRequestVO;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryResponseVO;
import com.yd.api.result.JsonResult; import com.yd.api.result.JsonResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -207,4 +209,18 @@ public class PractitionerController { ...@@ -207,4 +209,18 @@ public class PractitionerController {
result.setData(responseVO); result.setData(responseVO);
return result; return result;
} }
/**
* 体系团队成员信息查询
* @param requestVO
* @return AnnouncementQueryResponseVO
*/
@RequestMapping("/subordinateSystemMemberQuery")
public Object subordinateSystemMemberQuery(@RequestBody SubordinateSystemMemberQueryRequestVO requestVO){
JsonResult result = new JsonResult();
SubordinateSystemMemberQueryResponseVO responseVO = practitionerService.subordinateSystemMemberQuery(requestVO);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
} }
...@@ -9,6 +9,8 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO; ...@@ -9,6 +9,8 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO; import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*; import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.setting.*; import com.yd.api.practitioner.vo.setting.*;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryRequestVO;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryResponseVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service("practitionerService") @Service("practitionerService")
...@@ -109,4 +111,11 @@ public interface PractitionerService { ...@@ -109,4 +111,11 @@ public interface PractitionerService {
* @return * @return
*/ */
OwnOpportunityRecordSaveResponseVO ownOpportunityRecordSave(OwnOpportunityRecordSaveRequestVO requestVO); OwnOpportunityRecordSaveResponseVO ownOpportunityRecordSave(OwnOpportunityRecordSaveRequestVO requestVO);
/**
* 体系团队成员信息查询
* @param requestVO
* @return
*/
SubordinateSystemMemberQueryResponseVO subordinateSystemMemberQuery(SubordinateSystemMemberQueryRequestVO requestVO);
} }
...@@ -16,10 +16,15 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO; ...@@ -16,10 +16,15 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.rank.PractitionerInfoForAchievement; import com.yd.api.practitioner.vo.rank.PractitionerInfoForAchievement;
import com.yd.api.practitioner.vo.recruit.*; import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.setting.*; import com.yd.api.practitioner.vo.setting.*;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberInfo;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryRequestVO;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryResponseVO;
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemStatisticInfo;
import com.yd.api.result.CommonResult; import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.*; import com.yd.dal.entity.customer.*;
import com.yd.dal.entity.marketing.MktLeadsAssignedTrack; import com.yd.dal.entity.marketing.MktLeadsAssignedTrack;
import com.yd.dal.entity.marketing.MktLeadsAssigneds; import com.yd.dal.entity.marketing.MktLeadsAssigneds;
import com.yd.dal.entity.marketing.MktLeadsGoals;
import com.yd.dal.entity.marketing.MktLeadsPool; import com.yd.dal.entity.marketing.MktLeadsPool;
import com.yd.dal.entity.meta.MdDropOptions; import com.yd.dal.entity.meta.MdDropOptions;
import com.yd.dal.entity.meta.MdMkCampaign; import com.yd.dal.entity.meta.MdMkCampaign;
...@@ -31,6 +36,7 @@ import com.yd.dal.entity.survey.SurveyCustomerAnswers; ...@@ -31,6 +36,7 @@ import com.yd.dal.entity.survey.SurveyCustomerAnswers;
import com.yd.dal.service.customer.*; import com.yd.dal.service.customer.*;
import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService; import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService;
import com.yd.dal.service.marketing.MktLeadsAssignedsDALService; import com.yd.dal.service.marketing.MktLeadsAssignedsDALService;
import com.yd.dal.service.marketing.MktLeadsGoalsDALService;
import com.yd.dal.service.meta.*; import com.yd.dal.service.meta.*;
import com.yd.dal.service.order.PoOrderDALService; import com.yd.dal.service.order.PoOrderDALService;
import com.yd.dal.service.survey.SurveyCustomerAnswersDALService; import com.yd.dal.service.survey.SurveyCustomerAnswersDALService;
...@@ -58,6 +64,7 @@ import javax.imageio.ImageIO; ...@@ -58,6 +64,7 @@ import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -114,6 +121,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -114,6 +121,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
private AclUserDALService aclUserDALService; private AclUserDALService aclUserDALService;
@Autowired @Autowired
private AclPractitionerPotentialAssignedsDALService aclPractitionerPotentialAssignedsDALService; private AclPractitionerPotentialAssignedsDALService aclPractitionerPotentialAssignedsDALService;
@Autowired
private AclPractitionerSettingDALService aclpractitionersettingDALService;
@Autowired
private AclCustomerFortuneDALService aclCustomerFortuneDALService;
@Autowired
private MktLeadsGoalsDALService mktLeadsGoalsDALService;
@Override @Override
public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) { public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) {
...@@ -1225,6 +1238,145 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1225,6 +1238,145 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return resp; return resp;
} }
@Override
public SubordinateSystemMemberQueryResponseVO subordinateSystemMemberQuery(SubordinateSystemMemberQueryRequestVO requestVO) {
SubordinateSystemMemberQueryResponseVO responseVO = new SubordinateSystemMemberQueryResponseVO();
Long practitionerId = requestVO.getPractitionerId();
if(practitionerId != null){
List<AclPractitionerSubordinateSystem> subordinateSystemList = aclPractitionerSubordinateSystemDALService.findByOwner(practitionerId);
if(!subordinateSystemList.isEmpty() && subordinateSystemList.get(0) != null){
AclPractitionerSubordinateSystem subordinateSystem = subordinateSystemList.get(0);
Long subordinateSystemId = subordinateSystem.getId();
Integer time = requestVO.getTime();
time = (time == null) ? 1 : time;
List<SubordinateSystemMemberInfo> memberInfoList = new ArrayList<>();
SubordinateSystemStatisticInfo statisticInfo = new SubordinateSystemStatisticInfo();
//2、查询该团队长所在体系的所有成员
List<AclPractitioner> practitionerList = aclPractitionerDALService.findBySubordinateSystemId(subordinateSystemId);
double fypSum = 0D,fycSum = 0D;
int countSum = 0;
if(!practitionerList.isEmpty() && practitionerList.get(0) != null){
List<Long> practitionerIds = new ArrayList<>();
practitionerList.forEach(i->practitionerIds.add(i.getId()));
//3、查询该体系下经纪人的财富订单统计
List<AclCustomerFortuneStatistics> customerFortuneStatistics = aclCustomerFortuneDALService.findBySubordinateSystemStatistics(subordinateSystemId,time);
Map<Long,AclCustomerFortuneStatistics> customerFortuneStatisticsMap = new HashMap<>();
customerFortuneStatistics.forEach(i->customerFortuneStatisticsMap.put(i.getPractitionerId(),i));
//获取所有成员的级别
List<AclPractitionerSetting> practitionerSettings = aclpractitionersettingDALService.findByPractitionerIdList(practitionerIds);
Map<Long,Long> practitionerSettingMap = new HashMap<>();
practitionerSettings.forEach(i->practitionerSettingMap.put(i.getPractitionerId(),i.getPractitionerLevel()));
//获取所有经纪人登记的基础信息
List<MdDropOptions> practitionerLevelInfo = mdDropOptionsDALService.findByDropMasterCode("practitioner_level");//5L
Map<Long,String> levelInfoNameMap= new HashMap<>() ,levelInfoCodeMap = new HashMap<>();
practitionerLevelInfo.forEach(i->levelInfoNameMap.put(i.getId(),i.getDropOptionName()));
practitionerLevelInfo.forEach(i->levelInfoCodeMap.put(i.getId(),i.getDropOptionCode()));
SubordinateSystemMemberInfo memberInfo;
Long practitionerIdForMember,practitionerLevelId;
AclCustomerFortuneStatistics customerFortuneStatisticsItem;
for(AclPractitioner practitioner : practitionerList){
double fyp = 0D,fyc = 0D;
int count = 0;
practitionerIdForMember = practitioner.getId();
practitionerLevelId = practitionerSettingMap.get(practitionerIdForMember);
memberInfo = new SubordinateSystemMemberInfo();
memberInfo.setPractitionerId(practitionerIdForMember);
memberInfo.setName(practitioner.getName());
memberInfo.setLevelCode(levelInfoCodeMap.get(practitionerLevelId));
memberInfo.setLevelName(levelInfoNameMap.get(practitionerLevelId));
if(customerFortuneStatisticsMap.containsKey(practitionerIdForMember)){
customerFortuneStatisticsItem = customerFortuneStatisticsMap.get(practitionerIdForMember);
fyc = customerFortuneStatisticsItem.getFyc();
fyp = customerFortuneStatisticsItem.getFyp();
count = customerFortuneStatisticsItem.getCount();
fycSum = fycSum + fyc;
fypSum = fypSum + fyp;
countSum = countSum + count;
}
memberInfo.setFyc(fyc);
memberInfo.setFyp(fyp);
memberInfo.setCount(count);
memberInfoList.add(memberInfo);
}
}
//查询出来的结果按照fyp进行排序
memberInfoList.sort(Comparator.comparingDouble(SubordinateSystemMemberInfo::getFyp));
Collections.reverse(memberInfoList);
statisticInfo.setCount(countSum);
statisticInfo.setFyc(fycSum);
statisticInfo.setFyp(fypSum);
statisticInfo.setCompletionRate(getCompletionRate(subordinateSystemId,fycSum,time));
responseVO.setId(subordinateSystemId);
responseVO.setSubordinateSystemName(subordinateSystem.getName());
responseVO.setContactName(subordinateSystem.getContactName());
responseVO.setContactNo(subordinateSystem.getContactNo());
responseVO.setRemark(subordinateSystem.getRemark());
responseVO.setStatisticInfo(statisticInfo);
responseVO.setMemberInfoList(memberInfoList);
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
}else{
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("830054")));
}
}else{
String[] params = {"practitionerId"};
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("610001", params)));
}
return responseVO;
}
/**
* 获取团队的完成率
* @param subordinateSystemId 团队长ID
* @param fycSum 总的FYC
* @param time 时间
* @return 完成率
*/
private Double getCompletionRate(Long subordinateSystemId, Double fycSum,Integer time) {
if(subordinateSystemId != null && fycSum != null && time != null && fycSum > 0){
List<MktLeadsGoals> leadsGoals;
Double goalsPremium = null;
if(time == 2){
leadsGoals = mktLeadsGoalsDALService.findByTypeAndTimeUnitAndSubordinateSystemId(2,1,subordinateSystemId);
goalsPremium = (leadsGoals != null && leadsGoals.size() > 0) ? leadsGoals.get(0).getPremium() : null;
}else{
leadsGoals = mktLeadsGoalsDALService.findByTypeAndTimeUnitAndSubordinateSystemId(2,3,subordinateSystemId);
Calendar calendar = Calendar.getInstance();
int month = calendar.get(Calendar.MONTH)+1;
List<Integer> monthList = getMonthListForQuarter(month);
for(MktLeadsGoals item : leadsGoals){
if(time == 1){//月份
if(item.getSeqTime() == month){
goalsPremium = item.getPremium();
break;
}
}else{//季度
if(monthList.contains(item.getSeqTime())){
goalsPremium = (goalsPremium == null) ? item.getPremium() : goalsPremium + item.getPremium();
}
}
}
}
if(goalsPremium != null && goalsPremium > 0){
BigDecimal fycBigDecimal = new BigDecimal(fycSum),goalsBigDecimal = new BigDecimal(goalsPremium);
return fycBigDecimal.divide(goalsBigDecimal,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
}
return 0D;
}
private List<Integer> getMonthListForQuarter(int month) {
if(month < 4){
return Arrays.asList(1,2,3);
}else if(month < 7){
return Arrays.asList(4,5,6);
}else if(month < 10){
return Arrays.asList(7,8,9);
}else{
return Arrays.asList(10,11,12);
}
}
private CommonResult check(OwnOpportunityRecordSaveRequestVO requestVO) { private CommonResult check(OwnOpportunityRecordSaveRequestVO requestVO) {
String noticeDate = requestVO.getNoticeDate(); String noticeDate = requestVO.getNoticeDate();
if (CommonUtil.isNullOrBlank(noticeDate)){ if (CommonUtil.isNullOrBlank(noticeDate)){
......
...@@ -4,7 +4,7 @@ import java.io.Serializable; ...@@ -4,7 +4,7 @@ import java.io.Serializable;
public class AclCustomerFortuneStatistics implements Serializable { public class AclCustomerFortuneStatistics implements Serializable {
private Integer rank; private Integer rank;
private Long customerId; private Long customerId;
private String practitionerId; private Long practitionerId;
private String name; private String name;
private Long subordinateSystemId;//所属体系id private Long subordinateSystemId;//所属体系id
private String subordinateSystemName;//所属体系名称 private String subordinateSystemName;//所属体系名称
...@@ -29,11 +29,11 @@ public class AclCustomerFortuneStatistics implements Serializable { ...@@ -29,11 +29,11 @@ public class AclCustomerFortuneStatistics implements Serializable {
this.customerId = customerId; this.customerId = customerId;
} }
public String getPractitionerId() { public Long getPractitionerId() {
return practitionerId; return practitionerId;
} }
public void setPractitionerId(String practitionerId) { public void setPractitionerId(Long practitionerId) {
this.practitionerId = practitionerId; this.practitionerId = practitionerId;
} }
......
package com.yd.api.practitioner.vo.subordinate;
public class SubordinateSystemMemberInfo {
private Long practitionerId;
private String name;
private String levelCode;
private String levelName;
private Double fyp;
private Double fyc;
private Integer count;
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 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 Double getFyp() {
return fyp;
}
public void setFyp(Double fyp) {
this.fyp = fyp;
}
public Double getFyc() {
return fyc;
}
public void setFyc(Double fyc) {
this.fyc = fyc;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
}
package com.yd.api.practitioner.vo.subordinate;
public class SubordinateSystemMemberQueryRequestVO {
private Long practitionerId;
private Integer time;//1=month,3=quarter,2=year
private Integer type;//1=online,2=offLine
public Long getPractitionerId() {
return practitionerId;
}
public void setPractitionerId(Long practitionerId) {
this.practitionerId = practitionerId;
}
public Integer getTime() {
return time;
}
public void setTime(Integer time) {
this.time = time;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}
package com.yd.api.practitioner.vo.subordinate;
import com.yd.api.result.CommonResult;
import java.util.List;
public class SubordinateSystemMemberQueryResponseVO {
private Long id;
private String subordinateSystemName;
private String contactName;
private String contactNo;
private String remark;
private SubordinateSystemStatisticInfo statisticInfo;
private List<SubordinateSystemMemberInfo> memberInfoList;
private CommonResult commonResult;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getSubordinateSystemName() {
return subordinateSystemName;
}
public void setSubordinateSystemName(String subordinateSystemName) {
this.subordinateSystemName = subordinateSystemName;
}
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;
}
public SubordinateSystemStatisticInfo getStatisticInfo() {
return statisticInfo;
}
public void setStatisticInfo(SubordinateSystemStatisticInfo statisticInfo) {
this.statisticInfo = statisticInfo;
}
public List<SubordinateSystemMemberInfo> getMemberInfoList() {
return memberInfoList;
}
public void setMemberInfoList(List<SubordinateSystemMemberInfo> memberInfoList) {
this.memberInfoList = memberInfoList;
}
public CommonResult getCommonResult() {
return commonResult;
}
public void setCommonResult(CommonResult commonResult) {
this.commonResult = commonResult;
}
}
package com.yd.api.practitioner.vo.subordinate;
public class SubordinateSystemStatisticInfo {
private Double fyc;
private Double fyp;
private Integer count;
private Double completionRate;
public Double getFyc() {
return fyc;
}
public void setFyc(Double fyc) {
this.fyc = fyc;
}
public Double getFyp() {
return fyp;
}
public void setFyp(Double fyp) {
this.fyp = fyp;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public Double getCompletionRate() {
return completionRate;
}
public void setCompletionRate(Double completionRate) {
this.completionRate = completionRate;
}
}
package com.yd.dal.entity.customer;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* ag_acl_customer_fortune
* @author
*/
@Data
public class AclCustomerFortune implements Serializable {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_customer_share.id
*/
private Long shareId;
/**
* FK ag_acl_customer.id
*/
private Long customerId;
/**
* FK ag_po_order.id
*/
private Long orderId;
private Date orderDate;
private BigDecimal orderPrice;
/**
* FK ag_product_plan_commission,ag_product_life_plan_commission银盾来佣佣金率
*/
private BigDecimal commissionRate;
/**
* 银盾来佣佣金
*/
private BigDecimal commissionAmount;
/**
* FK ag_product_plan_commission,ag_product_life_plan_commission公告佣金率
*/
private BigDecimal announcementCommissionRate;
/**
* 公告佣金
*/
private BigDecimal announcementCommissionAmount;
/**
* FK ag_acl_channel_referral_rate个人职级佣金率
*/
private BigDecimal gradeCommissionRate;
/**
* %=referral amount / order price
*/
private BigDecimal referralRate;
private BigDecimal referralAmount;
/**
* 扣除6个点的企业增值税(6%)
*/
private BigDecimal referralAmountAfterValueadded;
/**
* 0=No, 1=Yes
*/
private Integer isTax;
private BigDecimal taxAmount;
private BigDecimal netAmount;
/**
* FK ag_md_mk_campaign.id
*/
private Long campaignId;
/**
* 可提现日期,在生产记录时就算好
*/
private Date withdrawableDate;
/**
* FK ag_acl_customer_fortune_withdraw.id 提现表的id
*/
private Long withdrawedId;
/**
* FK ag_acl_customer_fortune_pay.id 支付表的id
*/
private Long fortunePayedId;
/**
* 创建时间
*/
private Date createdAt;
/**
* FK ag_acl_customer.id
*/
private Long createdBy;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.entity.customer;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ag_acl_practitioner_setting
* @author
*/
@Data
public class AclPractitionerSetting implements Serializable {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_practitioner.id
*/
private Long practitionerId;
/**
* FK ag_md_drop_options.id,经纪人:1产险、2寿险、3商业
*/
private Long practitionerTypeId;
/**
* FK ag_md_drop_options.id,经纪人分成5个级别 : S2 、S1、 A3、 A2、 A1,level决定佣金比例
*/
private Long practitionerLevel;
/**
* 比例有效期起日
*/
private Date levelStartDate;
/**
* 比例有效期终日
*/
private Date levelEndDate;
/**
* 备注
*/
private String remark;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* 建置日
*/
private Date createdAt;
/**
* 建置者
*/
private Long createdBy;
/**
* 更新日
*/
private Date updatedAt;
private Long updatedBy;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.entity.marketing;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ag_mkt_leads_goals
* @author
*/
@Data
public class MktLeadsGoals implements Serializable {
/**
* serial id
*/
private Long id;
/**
* 目标类型:1:经纪人指标,2:团队指标
*/
private Integer goalsType;
/**
* FK ag_acl_practitioner.id 经纪人(或团队长)
*/
private Long practitionerId;
/**
* FK ag_acl_practitioner_subordinate_system.id 团队ID
*/
private Long subordinateSystemId;
/**
* FK ag_acl_practitioner_subordinate_system.name 团队Name
*/
private String subordinateSystemName;
/**
* 目标所属年度
*/
private Integer currentYear;
/**
* 1:年度,3:月度
*/
private Integer statisticTimeUnit;
/**
* 1:年度,3:月度
*/
private Integer seqTime;
/**
* 保费
*/
private Double premium;
/**
* 佣金
*/
private Double commission;
/**
* 件数
*/
private Integer pieces;
/**
* 件均保费: 计算生成 FYP/件数
*/
private Double pieceAveragePremium;
/**
* 版本控制
*/
private Date currentVersion;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private Long createdBy;
/**
* 修改时间
*/
private Date updatedAt;
private Long updatedBy;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;
import com.yd.dal.entity.customer.AclCustomerFortune;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AclCustomerFortuneMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerFortune record);
int insertSelective(AclCustomerFortune record);
AclCustomerFortune selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerFortune record);
int updateByPrimaryKey(AclCustomerFortune record);
List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(@Param("subordinateSystemId") Long subordinateSystemId, @Param("time") Integer time);
}
\ No newline at end of file
...@@ -39,4 +39,6 @@ public interface AclPractitionerMapper { ...@@ -39,4 +39,6 @@ public interface AclPractitionerMapper {
List<OwnOpportunityInfo> ownOpportunityQuery(@Param("practitionerId")Long practitionerId); List<OwnOpportunityInfo> ownOpportunityQuery(@Param("practitionerId")Long practitionerId);
List<AclPractitioner> findByIds(@Param("practitionerIdList") List<Long> practitionerIdList); List<AclPractitioner> findByIds(@Param("practitionerIdList") List<Long> practitionerIdList);
List<AclPractitioner> findBySubordinateSystemId(@Param("subordinateSystemId")Long subordinateSystemId);
} }
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclPractitionerSetting;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AclPractitionerSettingMapper {
int deleteByPrimaryKey(Long id);
int insert(AclPractitionerSetting record);
int insertSelective(AclPractitionerSetting record);
AclPractitionerSetting selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclPractitionerSetting record);
int updateByPrimaryKey(AclPractitionerSetting record);
List<AclPractitionerSetting> findByPractitionerIdList(@Param("practitionerIds") List<Long> practitionerIds);
}
\ No newline at end of file
...@@ -2,6 +2,9 @@ package com.yd.dal.mapper.customer; ...@@ -2,6 +2,9 @@ package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclPractitionerSubordinateSystem; import com.yd.dal.entity.customer.AclPractitionerSubordinateSystem;
import com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo; import com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AclPractitionerSubordinateSystemMapper { public interface AclPractitionerSubordinateSystemMapper {
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
...@@ -17,4 +20,6 @@ public interface AclPractitionerSubordinateSystemMapper { ...@@ -17,4 +20,6 @@ public interface AclPractitionerSubordinateSystemMapper {
int updateByPrimaryKey(AclPractitionerSubordinateSystem record); int updateByPrimaryKey(AclPractitionerSubordinateSystem record);
PractitionerSubordinateInfo findSubordinateInfo(Long subordinateId); PractitionerSubordinateInfo findSubordinateInfo(Long subordinateId);
List<AclPractitionerSubordinateSystem> findByOwner(@Param("practitionerId") Long practitionerId);
} }
\ No newline at end of file
package com.yd.dal.mapper.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoals;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MktLeadsGoalsMapper {
int deleteByPrimaryKey(Long id);
int insert(MktLeadsGoals record);
int insertSelective(MktLeadsGoals record);
MktLeadsGoals selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(MktLeadsGoals record);
int updateByPrimaryKey(MktLeadsGoals record);
List<MktLeadsGoals> findByTypeAndTimeUnitAndSubordinateSystemId(@Param("goalsType") Integer goalsType, @Param("statisticTimeUnit")Integer statisticTimeUnit, @Param("subordinateSystemId")Long subordinateSystemId);
}
\ No newline at end of file
package com.yd.dal.service.customer;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("aclCustomerFortuneDALService")
public interface AclCustomerFortuneDALService {
List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time);
}
...@@ -82,4 +82,11 @@ public interface AclPractitionerDALService { ...@@ -82,4 +82,11 @@ public interface AclPractitionerDALService {
* @return * @return
*/ */
List<AclPractitioner> findByIds(List<Long> practitionerIdList); List<AclPractitioner> findByIds(List<Long> practitionerIdList);
/**
* 根据体系id查询经纪人
* @param subordinateSystemId 体系id
* @return
*/
List<AclPractitioner> findBySubordinateSystemId(Long subordinateSystemId);
} }
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclPractitionerSetting;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("aclPractitionerSettingDALService")
public interface AclPractitionerSettingDALService {
List<AclPractitionerSetting> findByPractitionerIdList(List<Long> practitionerIds);
}
package com.yd.dal.service.customer; package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclPractitionerSubordinateSystem;
import com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo; import com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service("aclPractitionerSubordinateSystemDALService") @Service("aclPractitionerSubordinateSystemDALService")
public interface AclPractitionerSubordinateSystemDALService { public interface AclPractitionerSubordinateSystemDALService {
PractitionerSubordinateInfo findSubordinateInfo(Long subordinateId); PractitionerSubordinateInfo findSubordinateInfo(Long subordinateId);
List<AclPractitionerSubordinateSystem> findByOwner(Long practitionerId);
} }
package com.yd.dal.service.customer.impl;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;
import com.yd.dal.mapper.customer.AclCustomerFortuneMapper;
import com.yd.dal.service.customer.AclCustomerFortuneDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("aclCustomerFortuneDALService")
public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALService {
@Resource
private AclCustomerFortuneMapper aclCustomerFortuneMapper;
@Override
public List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time) {
return aclCustomerFortuneMapper.findBySubordinateSystemStatistics(subordinateSystemId,time);
}
}
...@@ -88,4 +88,9 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService ...@@ -88,4 +88,9 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService
public List<AclPractitioner> findByIds(List<Long> practitionerIdList) { public List<AclPractitioner> findByIds(List<Long> practitionerIdList) {
return aclPractitionerMapper.findByIds(practitionerIdList); return aclPractitionerMapper.findByIds(practitionerIdList);
} }
@Override
public List<AclPractitioner> findBySubordinateSystemId(Long subordinateSystemId) {
return aclPractitionerMapper.findBySubordinateSystemId(subordinateSystemId);
}
} }
package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.AclPractitionerSetting;
import com.yd.dal.mapper.customer.AclPractitionerSettingMapper;
import com.yd.dal.service.customer.AclPractitionerSettingDALService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("aclPractitionerSettingDALService")
public class AclPractitionerSettingDALServiceImpl implements AclPractitionerSettingDALService {
@Autowired
private AclPractitionerSettingMapper aclPractitionerSettingMapper;
@Override
public List<AclPractitionerSetting> findByPractitionerIdList(List<Long> practitionerIds) {
return aclPractitionerSettingMapper.findByPractitionerIdList(practitionerIds);
}
}
package com.yd.dal.service.customer.impl; package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.AclPractitionerSubordinateSystem;
import com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo; import com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo;
import com.yd.dal.mapper.customer.AclPractitionerSubordinateSystemMapper; import com.yd.dal.mapper.customer.AclPractitionerSubordinateSystemMapper;
import com.yd.dal.service.customer.AclPractitionerSubordinateSystemDALService; import com.yd.dal.service.customer.AclPractitionerSubordinateSystemDALService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
@Service("aclPractitionerSubordinateSystemDALService") @Service("aclPractitionerSubordinateSystemDALService")
public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPractitionerSubordinateSystemDALService { public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPractitionerSubordinateSystemDALService {
...@@ -24,4 +26,9 @@ public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPracti ...@@ -24,4 +26,9 @@ public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPracti
} }
return subordinateInfo; return subordinateInfo;
} }
@Override
public List<AclPractitionerSubordinateSystem> findByOwner(Long practitionerId) {
return aclPractitionerSubordinateSystemMapper.findByOwner(practitionerId);
}
} }
package com.yd.dal.service.marketing.Impl;
import com.yd.dal.entity.marketing.MktLeadsGoals;
import com.yd.dal.mapper.marketing.MktLeadsGoalsMapper;
import com.yd.dal.service.marketing.MktLeadsGoalsDALService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("mktLeadsGoalsDALService")
public class MktLeadsGoalsDALServiceImpl implements MktLeadsGoalsDALService {
@Autowired
private MktLeadsGoalsMapper mktLeadsGoalsMapper;
@Override
public List<MktLeadsGoals> findByTypeAndTimeUnitAndSubordinateSystemId(Integer goalsType, Integer statisticTimeUnit, Long subordinateSystemId) {
return mktLeadsGoalsMapper.findByTypeAndTimeUnitAndSubordinateSystemId(goalsType,statisticTimeUnit,subordinateSystemId);
}
}
package com.yd.dal.service.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoals;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("mktLeadsGoalsDALService")
public interface MktLeadsGoalsDALService {
List<MktLeadsGoals> findByTypeAndTimeUnitAndSubordinateSystemId(Integer goalsType, Integer statisticTimeUnit, Long subordinateSystemId);
}
<?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.AclCustomerFortuneMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerFortune">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="share_id" jdbcType="BIGINT" property="shareId" />
<result column="customer_id" jdbcType="BIGINT" property="customerId" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="order_date" jdbcType="TIMESTAMP" property="orderDate" />
<result column="order_price" jdbcType="DECIMAL" property="orderPrice" />
<result column="commission_rate" jdbcType="DECIMAL" property="commissionRate" />
<result column="commission_amount" jdbcType="DECIMAL" property="commissionAmount" />
<result column="announcement_commission_rate" jdbcType="DECIMAL" property="announcementCommissionRate" />
<result column="announcement_commission_amount" jdbcType="DECIMAL" property="announcementCommissionAmount" />
<result column="grade_commission_rate" jdbcType="DECIMAL" property="gradeCommissionRate" />
<result column="referral_rate" jdbcType="DECIMAL" property="referralRate" />
<result column="referral_amount" jdbcType="DECIMAL" property="referralAmount" />
<result column="referral_amount_after_valueadded" jdbcType="DECIMAL" property="referralAmountAfterValueadded" />
<result column="is_tax" jdbcType="INTEGER" property="isTax" />
<result column="tax_amount" jdbcType="DECIMAL" property="taxAmount" />
<result column="net_amount" jdbcType="DECIMAL" property="netAmount" />
<result column="campaign_id" jdbcType="BIGINT" property="campaignId" />
<result column="withdrawable_date" jdbcType="TIMESTAMP" property="withdrawableDate" />
<result column="withdrawed_id" jdbcType="BIGINT" property="withdrawedId" />
<result column="fortune_payed_id" jdbcType="BIGINT" property="fortunePayedId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
</resultMap>
<sql id="Base_Column_List">
id, share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount,
announcement_commission_rate, announcement_commission_amount, grade_commission_rate,
referral_rate, referral_amount, referral_amount_after_valueadded, is_tax, tax_amount,
net_amount, campaign_id, withdrawable_date, withdrawed_id, fortune_payed_id, created_at,
created_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ag_acl_customer_fortune
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true">
insert into ag_acl_customer_fortune (share_id, customer_id, order_id,
order_date, order_price, commission_rate,
commission_amount, announcement_commission_rate,
announcement_commission_amount, grade_commission_rate,
referral_rate, referral_amount, referral_amount_after_valueadded,
is_tax, tax_amount, net_amount,
campaign_id, withdrawable_date, withdrawed_id,
fortune_payed_id, created_at, created_by
)
values (#{shareId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT},
#{orderDate,jdbcType=TIMESTAMP}, #{orderPrice,jdbcType=DECIMAL}, #{commissionRate,jdbcType=DECIMAL},
#{commissionAmount,jdbcType=DECIMAL}, #{announcementCommissionRate,jdbcType=DECIMAL},
#{announcementCommissionAmount,jdbcType=DECIMAL}, #{gradeCommissionRate,jdbcType=DECIMAL},
#{referralRate,jdbcType=DECIMAL}, #{referralAmount,jdbcType=DECIMAL}, #{referralAmountAfterValueadded,jdbcType=DECIMAL},
#{isTax,jdbcType=INTEGER}, #{taxAmount,jdbcType=DECIMAL}, #{netAmount,jdbcType=DECIMAL},
#{campaignId,jdbcType=BIGINT}, #{withdrawableDate,jdbcType=TIMESTAMP}, #{withdrawedId,jdbcType=BIGINT},
#{fortunePayedId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true">
insert into ag_acl_customer_fortune
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="shareId != null">
share_id,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="orderId != null">
order_id,
</if>
<if test="orderDate != null">
order_date,
</if>
<if test="orderPrice != null">
order_price,
</if>
<if test="commissionRate != null">
commission_rate,
</if>
<if test="commissionAmount != null">
commission_amount,
</if>
<if test="announcementCommissionRate != null">
announcement_commission_rate,
</if>
<if test="announcementCommissionAmount != null">
announcement_commission_amount,
</if>
<if test="gradeCommissionRate != null">
grade_commission_rate,
</if>
<if test="referralRate != null">
referral_rate,
</if>
<if test="referralAmount != null">
referral_amount,
</if>
<if test="referralAmountAfterValueadded != null">
referral_amount_after_valueadded,
</if>
<if test="isTax != null">
is_tax,
</if>
<if test="taxAmount != null">
tax_amount,
</if>
<if test="netAmount != null">
net_amount,
</if>
<if test="campaignId != null">
campaign_id,
</if>
<if test="withdrawableDate != null">
withdrawable_date,
</if>
<if test="withdrawedId != null">
withdrawed_id,
</if>
<if test="fortunePayedId != null">
fortune_payed_id,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="shareId != null">
#{shareId,jdbcType=BIGINT},
</if>
<if test="customerId != null">
#{customerId,jdbcType=BIGINT},
</if>
<if test="orderId != null">
#{orderId,jdbcType=BIGINT},
</if>
<if test="orderDate != null">
#{orderDate,jdbcType=TIMESTAMP},
</if>
<if test="orderPrice != null">
#{orderPrice,jdbcType=DECIMAL},
</if>
<if test="commissionRate != null">
#{commissionRate,jdbcType=DECIMAL},
</if>
<if test="commissionAmount != null">
#{commissionAmount,jdbcType=DECIMAL},
</if>
<if test="announcementCommissionRate != null">
#{announcementCommissionRate,jdbcType=DECIMAL},
</if>
<if test="announcementCommissionAmount != null">
#{announcementCommissionAmount,jdbcType=DECIMAL},
</if>
<if test="gradeCommissionRate != null">
#{gradeCommissionRate,jdbcType=DECIMAL},
</if>
<if test="referralRate != null">
#{referralRate,jdbcType=DECIMAL},
</if>
<if test="referralAmount != null">
#{referralAmount,jdbcType=DECIMAL},
</if>
<if test="referralAmountAfterValueadded != null">
#{referralAmountAfterValueadded,jdbcType=DECIMAL},
</if>
<if test="isTax != null">
#{isTax,jdbcType=INTEGER},
</if>
<if test="taxAmount != null">
#{taxAmount,jdbcType=DECIMAL},
</if>
<if test="netAmount != null">
#{netAmount,jdbcType=DECIMAL},
</if>
<if test="campaignId != null">
#{campaignId,jdbcType=BIGINT},
</if>
<if test="withdrawableDate != null">
#{withdrawableDate,jdbcType=TIMESTAMP},
</if>
<if test="withdrawedId != null">
#{withdrawedId,jdbcType=BIGINT},
</if>
<if test="fortunePayedId != null">
#{fortunePayedId,jdbcType=BIGINT},
</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.AclCustomerFortune">
update ag_acl_customer_fortune
<set>
<if test="shareId != null">
share_id = #{shareId,jdbcType=BIGINT},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=BIGINT},
</if>
<if test="orderId != null">
order_id = #{orderId,jdbcType=BIGINT},
</if>
<if test="orderDate != null">
order_date = #{orderDate,jdbcType=TIMESTAMP},
</if>
<if test="orderPrice != null">
order_price = #{orderPrice,jdbcType=DECIMAL},
</if>
<if test="commissionRate != null">
commission_rate = #{commissionRate,jdbcType=DECIMAL},
</if>
<if test="commissionAmount != null">
commission_amount = #{commissionAmount,jdbcType=DECIMAL},
</if>
<if test="announcementCommissionRate != null">
announcement_commission_rate = #{announcementCommissionRate,jdbcType=DECIMAL},
</if>
<if test="announcementCommissionAmount != null">
announcement_commission_amount = #{announcementCommissionAmount,jdbcType=DECIMAL},
</if>
<if test="gradeCommissionRate != null">
grade_commission_rate = #{gradeCommissionRate,jdbcType=DECIMAL},
</if>
<if test="referralRate != null">
referral_rate = #{referralRate,jdbcType=DECIMAL},
</if>
<if test="referralAmount != null">
referral_amount = #{referralAmount,jdbcType=DECIMAL},
</if>
<if test="referralAmountAfterValueadded != null">
referral_amount_after_valueadded = #{referralAmountAfterValueadded,jdbcType=DECIMAL},
</if>
<if test="isTax != null">
is_tax = #{isTax,jdbcType=INTEGER},
</if>
<if test="taxAmount != null">
tax_amount = #{taxAmount,jdbcType=DECIMAL},
</if>
<if test="netAmount != null">
net_amount = #{netAmount,jdbcType=DECIMAL},
</if>
<if test="campaignId != null">
campaign_id = #{campaignId,jdbcType=BIGINT},
</if>
<if test="withdrawableDate != null">
withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP},
</if>
<if test="withdrawedId != null">
withdrawed_id = #{withdrawedId,jdbcType=BIGINT},
</if>
<if test="fortunePayedId != null">
fortune_payed_id = #{fortunePayedId,jdbcType=BIGINT},
</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.AclCustomerFortune">
update ag_acl_customer_fortune
set share_id = #{shareId,jdbcType=BIGINT},
customer_id = #{customerId,jdbcType=BIGINT},
order_id = #{orderId,jdbcType=BIGINT},
order_date = #{orderDate,jdbcType=TIMESTAMP},
order_price = #{orderPrice,jdbcType=DECIMAL},
commission_rate = #{commissionRate,jdbcType=DECIMAL},
commission_amount = #{commissionAmount,jdbcType=DECIMAL},
announcement_commission_rate = #{announcementCommissionRate,jdbcType=DECIMAL},
announcement_commission_amount = #{announcementCommissionAmount,jdbcType=DECIMAL},
grade_commission_rate = #{gradeCommissionRate,jdbcType=DECIMAL},
referral_rate = #{referralRate,jdbcType=DECIMAL},
referral_amount = #{referralAmount,jdbcType=DECIMAL},
referral_amount_after_valueadded = #{referralAmountAfterValueadded,jdbcType=DECIMAL},
is_tax = #{isTax,jdbcType=INTEGER},
tax_amount = #{taxAmount,jdbcType=DECIMAL},
net_amount = #{netAmount,jdbcType=DECIMAL},
campaign_id = #{campaignId,jdbcType=BIGINT},
withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP},
withdrawed_id = #{withdrawedId,jdbcType=BIGINT},
fortune_payed_id = #{fortunePayedId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findBySubordinateSystemStatistics"
resultType="com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics">
SELECT
f.customer_id customerId ,
p.id practitionerId ,
p.`name` name ,
p.subordinate_system_id subordinateSystemId ,
COUNT(f.id) count ,
SUM(f.order_price) FYP ,
SUM(f.referral_amount) FYC ,
s.practitioner_level practitionerLevelId
FROM
((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
INNER JOIN ag_acl_customer_fortune f ON f.customer_id = p.customer_id )
INNER JOIN ag_po_order o ON f.order_id = o.id
WHERE
o.status = 3 and o.order_price > 0
<choose>
<when test="time == 1">
and DATE_FORMAT(f.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
and QUARTER(f.order_date) = QUARTER(NOW()) AND year(f.order_date)=year(now())
</when>
<otherwise>
and YEAR(f.order_date) = YEAR(now())
</otherwise>
</choose>
AND p.subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT}
GROUP BY f.customer_id
</select>
</mapper>
\ No newline at end of file
...@@ -714,4 +714,10 @@ ...@@ -714,4 +714,10 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="findBySubordinateSystemId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_practitioner
where subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT} and is_active = 1
</select>
</mapper> </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.AclPractitionerSettingMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclPractitionerSetting">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="practitioner_id" jdbcType="BIGINT" property="practitionerId" />
<result column="practitioner_type_id" jdbcType="BIGINT" property="practitionerTypeId" />
<result column="practitioner_level" jdbcType="BIGINT" property="practitionerLevel" />
<result column="level_start_date" jdbcType="DATE" property="levelStartDate" />
<result column="level_end_date" jdbcType="DATE" property="levelEndDate" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
id, practitioner_id, practitioner_type_id, practitioner_level, level_start_date,
level_end_date, remark, is_active, created_at, created_by, updated_at, updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_practitioner_setting
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ag_acl_practitioner_setting
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclPractitionerSetting" useGeneratedKeys="true">
insert into ag_acl_practitioner_setting (practitioner_id, practitioner_type_id,
practitioner_level, level_start_date, level_end_date,
remark, is_active, created_at,
created_by, updated_at, updated_by
)
values (#{practitionerId,jdbcType=BIGINT}, #{practitionerTypeId,jdbcType=BIGINT},
#{practitionerLevel,jdbcType=BIGINT}, #{levelStartDate,jdbcType=DATE}, #{levelEndDate,jdbcType=DATE},
#{remark,jdbcType=VARCHAR}, #{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclPractitionerSetting" useGeneratedKeys="true">
insert into ag_acl_practitioner_setting
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="practitionerId != null">
practitioner_id,
</if>
<if test="practitionerTypeId != null">
practitioner_type_id,
</if>
<if test="practitionerLevel != null">
practitioner_level,
</if>
<if test="levelStartDate != null">
level_start_date,
</if>
<if test="levelEndDate != null">
level_end_date,
</if>
<if test="remark != null">
remark,
</if>
<if test="isActive != null">
is_active,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="practitionerId != null">
#{practitionerId,jdbcType=BIGINT},
</if>
<if test="practitionerTypeId != null">
#{practitionerTypeId,jdbcType=BIGINT},
</if>
<if test="practitionerLevel != null">
#{practitionerLevel,jdbcType=BIGINT},
</if>
<if test="levelStartDate != null">
#{levelStartDate,jdbcType=DATE},
</if>
<if test="levelEndDate != null">
#{levelEndDate,jdbcType=DATE},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclPractitionerSetting">
update ag_acl_practitioner_setting
<set>
<if test="practitionerId != null">
practitioner_id = #{practitionerId,jdbcType=BIGINT},
</if>
<if test="practitionerTypeId != null">
practitioner_type_id = #{practitionerTypeId,jdbcType=BIGINT},
</if>
<if test="practitionerLevel != null">
practitioner_level = #{practitionerLevel,jdbcType=BIGINT},
</if>
<if test="levelStartDate != null">
level_start_date = #{levelStartDate,jdbcType=DATE},
</if>
<if test="levelEndDate != null">
level_end_date = #{levelEndDate,jdbcType=DATE},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="isActive != null">
is_active = #{isActive,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclPractitionerSetting">
update ag_acl_practitioner_setting
set practitioner_id = #{practitionerId,jdbcType=BIGINT},
practitioner_type_id = #{practitionerTypeId,jdbcType=BIGINT},
practitioner_level = #{practitionerLevel,jdbcType=BIGINT},
level_start_date = #{levelStartDate,jdbcType=DATE},
level_end_date = #{levelEndDate,jdbcType=DATE},
remark = #{remark,jdbcType=VARCHAR},
is_active = #{isActive,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findByPractitionerIdList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_practitioner_setting
where practitioner_id in
<foreach collection="practitionerIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
...@@ -242,4 +242,10 @@ ...@@ -242,4 +242,10 @@
and s.id = #{subordinateId} and s.id = #{subordinateId}
</select> </select>
<select id="findByOwner" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_practitioner_subordinate_system
where owner_practitioner_id = #{practitionerId,jdbcType=BIGINT} and is_active = 1
</select>
</mapper> </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.MktLeadsGoalsMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.marketing.MktLeadsGoals">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="goals_type" jdbcType="INTEGER" property="goalsType" />
<result column="practitioner_id" jdbcType="BIGINT" property="practitionerId" />
<result column="subordinate_system_id" jdbcType="BIGINT" property="subordinateSystemId" />
<result column="subordinate_system_name" jdbcType="VARCHAR" property="subordinateSystemName" />
<result column="current_year" jdbcType="INTEGER" property="currentYear" />
<result column="statistic_time_unit" jdbcType="INTEGER" property="statisticTimeUnit" />
<result column="seq_time" jdbcType="INTEGER" property="seqTime" />
<result column="premium" jdbcType="INTEGER" property="premium" />
<result column="commission" jdbcType="INTEGER" property="commission" />
<result column="pieces" jdbcType="INTEGER" property="pieces" />
<result column="piece_average_premium" jdbcType="INTEGER" property="pieceAveragePremium" />
<result column="current_version" jdbcType="TIMESTAMP" property="currentVersion" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
id, goals_type, practitioner_id, subordinate_system_id, subordinate_system_name,
current_year, statistic_time_unit, seq_time, premium, commission, pieces, piece_average_premium,
current_version, is_active, created_at, created_by, updated_at, updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_mkt_leads_goals
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ag_mkt_leads_goals
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.marketing.MktLeadsGoals" useGeneratedKeys="true">
insert into ag_mkt_leads_goals (goals_type, practitioner_id, subordinate_system_id,
subordinate_system_name, current_year, statistic_time_unit,
seq_time, premium, commission,
pieces, piece_average_premium, current_version,
is_active, created_at, created_by,
updated_at, updated_by)
values (#{goalsType,jdbcType=INTEGER}, #{practitionerId,jdbcType=BIGINT}, #{subordinateSystemId,jdbcType=BIGINT},
#{subordinateSystemName,jdbcType=VARCHAR}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit,jdbcType=INTEGER},
#{seqTime,jdbcType=INTEGER}, #{premium,jdbcType=INTEGER}, #{commission,jdbcType=INTEGER},
#{pieces,jdbcType=INTEGER}, #{pieceAveragePremium,jdbcType=INTEGER}, #{currentVersion,jdbcType=TIMESTAMP},
#{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.marketing.MktLeadsGoals" useGeneratedKeys="true">
insert into ag_mkt_leads_goals
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="goalsType != null">
goals_type,
</if>
<if test="practitionerId != null">
practitioner_id,
</if>
<if test="subordinateSystemId != null">
subordinate_system_id,
</if>
<if test="subordinateSystemName != null">
subordinate_system_name,
</if>
<if test="currentYear != null">
current_year,
</if>
<if test="statisticTimeUnit != null">
statistic_time_unit,
</if>
<if test="seqTime != null">
seq_time,
</if>
<if test="premium != null">
premium,
</if>
<if test="commission != null">
commission,
</if>
<if test="pieces != null">
pieces,
</if>
<if test="pieceAveragePremium != null">
piece_average_premium,
</if>
<if test="currentVersion != null">
current_version,
</if>
<if test="isActive != null">
is_active,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="goalsType != null">
#{goalsType,jdbcType=INTEGER},
</if>
<if test="practitionerId != null">
#{practitionerId,jdbcType=BIGINT},
</if>
<if test="subordinateSystemId != null">
#{subordinateSystemId,jdbcType=BIGINT},
</if>
<if test="subordinateSystemName != null">
#{subordinateSystemName,jdbcType=VARCHAR},
</if>
<if test="currentYear != null">
#{currentYear,jdbcType=INTEGER},
</if>
<if test="statisticTimeUnit != null">
#{statisticTimeUnit,jdbcType=INTEGER},
</if>
<if test="seqTime != null">
#{seqTime,jdbcType=INTEGER},
</if>
<if test="premium != null">
#{premium,jdbcType=INTEGER},
</if>
<if test="commission != null">
#{commission,jdbcType=INTEGER},
</if>
<if test="pieces != null">
#{pieces,jdbcType=INTEGER},
</if>
<if test="pieceAveragePremium != null">
#{pieceAveragePremium,jdbcType=INTEGER},
</if>
<if test="currentVersion != null">
#{currentVersion,jdbcType=TIMESTAMP},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.marketing.MktLeadsGoals">
update ag_mkt_leads_goals
<set>
<if test="goalsType != null">
goals_type = #{goalsType,jdbcType=INTEGER},
</if>
<if test="practitionerId != null">
practitioner_id = #{practitionerId,jdbcType=BIGINT},
</if>
<if test="subordinateSystemId != null">
subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT},
</if>
<if test="subordinateSystemName != null">
subordinate_system_name = #{subordinateSystemName,jdbcType=VARCHAR},
</if>
<if test="currentYear != null">
current_year = #{currentYear,jdbcType=INTEGER},
</if>
<if test="statisticTimeUnit != null">
statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER},
</if>
<if test="seqTime != null">
seq_time = #{seqTime,jdbcType=INTEGER},
</if>
<if test="premium != null">
premium = #{premium,jdbcType=INTEGER},
</if>
<if test="commission != null">
commission = #{commission,jdbcType=INTEGER},
</if>
<if test="pieces != null">
pieces = #{pieces,jdbcType=INTEGER},
</if>
<if test="pieceAveragePremium != null">
piece_average_premium = #{pieceAveragePremium,jdbcType=INTEGER},
</if>
<if test="currentVersion != null">
current_version = #{currentVersion,jdbcType=TIMESTAMP},
</if>
<if test="isActive != null">
is_active = #{isActive,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.marketing.MktLeadsGoals">
update ag_mkt_leads_goals
set goals_type = #{goalsType,jdbcType=INTEGER},
practitioner_id = #{practitionerId,jdbcType=BIGINT},
subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT},
subordinate_system_name = #{subordinateSystemName,jdbcType=VARCHAR},
current_year = #{currentYear,jdbcType=INTEGER},
statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER},
seq_time = #{seqTime,jdbcType=INTEGER},
premium = #{premium,jdbcType=INTEGER},
commission = #{commission,jdbcType=INTEGER},
pieces = #{pieces,jdbcType=INTEGER},
piece_average_premium = #{pieceAveragePremium,jdbcType=INTEGER},
current_version = #{currentVersion,jdbcType=TIMESTAMP},
is_active = #{isActive,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findByTypeAndTimeUnitAndSubordinateSystemId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_mkt_leads_goals
where goals_type = #{goalsType,jdbcType=INTEGER}
and statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER}
and subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT}
and is_active = 1
</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