Commit 7ee2b80b by Water Wang

resolve conflict

parents 2687cfd3 d435f32c
......@@ -11,6 +11,8 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.*;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -219,6 +221,7 @@ public class PractitionerController {
}
/**
<<<<<<< HEAD
* 经纪人-ydLife查询此经纪人总分数 按年月周日 分别统计 新增商机个数 达成率
* @param requestVO 请求数据
* @return 响应数据
......@@ -315,4 +318,17 @@ public class PractitionerController {
result.setData(responseVO);
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;
}
}
......@@ -10,6 +10,8 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.*;
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;
@Service("practitionerService")
......@@ -159,4 +161,10 @@ public interface PractitionerService {
* @return
*/
SalesPerformanceForecastListQueryResponseVO salesPerformanceForecastListQuery(SalesPerformanceForecastListQueryRequestVO requestVO);
/**
* 体系团队成员信息查询
* @param requestVO
* @return
*/
SubordinateSystemMemberQueryResponseVO subordinateSystemMemberQuery(SubordinateSystemMemberQueryRequestVO requestVO);
}
......@@ -17,16 +17,31 @@ import com.yd.api.practitioner.vo.rank.PractitionerInfoForAchievement;
import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.*;
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.dal.entity.customer.*;
import com.yd.dal.entity.marketing.*;
import com.yd.dal.entity.meta.*;
import com.yd.dal.entity.marketing.MktLeadsAssignedTrack;
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.meta.MdDropOptions;
import com.yd.dal.entity.meta.MdMkCampaign;
import com.yd.dal.entity.meta.MdTag;
import com.yd.dal.entity.meta.ObjectCollectionTagged;
import com.yd.dal.entity.practitioner.opportunity.OwnOpportunityInfo;
import com.yd.dal.entity.order.PoOrder;
import com.yd.dal.entity.practitioner.opportunity.PlayerSalesActivityInfo;
import com.yd.dal.entity.survey.SurveyCustomerAnswers;
import com.yd.dal.service.customer.*;
import com.yd.dal.service.marketing.*;
import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService;
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.order.PoOrderDALService;
import com.yd.dal.service.survey.SurveyCustomerAnswersDALService;
......@@ -127,6 +142,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
private MdGoalsCalculateExpressionService mdGoalsCalculateExpressionService;
@Autowired
private MktLeadsGoalsActionsDALService mktLeadsGoalsActionsDALService;
@Autowired
private AclPractitionerSettingDALService aclpractitionersettingDALService;
@Autowired
private AclCustomerFortuneDALService aclCustomerFortuneDALService;
@Override
public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) {
......@@ -2072,6 +2091,144 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
mktLeadsGoals.setIsActive(1);
mktLeadsGoalsDALService.saveMktLeadsGoals(mktLeadsGoals);
}
@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(CommonUtil.doubleFormat(fyc,2));
memberInfo.setFyp(CommonUtil.doubleFormat(fyp,2));
memberInfo.setCount(count);
memberInfoList.add(memberInfo);
}
}
//查询出来的结果按照fyp进行排序
memberInfoList.sort(Comparator.comparingDouble(SubordinateSystemMemberInfo::getFyp));
Collections.reverse(memberInfoList);
statisticInfo.setCount(countSum);
statisticInfo.setFyc(CommonUtil.doubleFormat(fycSum,2));
statisticInfo.setFyp(CommonUtil.doubleFormat(fypSum,2));
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.getCommission();
break;
}
}else{//季度
if(monthList.contains(item.getSeqTime())){
goalsPremium = (goalsPremium == null) ? item.getCommission() : goalsPremium + item.getCommission();
}
}
}
}
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) {
String noticeDate = requestVO.getNoticeDate();
......
......@@ -4,7 +4,7 @@ import java.io.Serializable;
public class AclCustomerFortuneStatistics implements Serializable {
private Integer rank;
private Long customerId;
private String practitionerId;
private Long practitionerId;
private String name;
private Long subordinateSystemId;//所属体系id
private String subordinateSystemName;//所属体系名称
......@@ -29,11 +29,11 @@ public class AclCustomerFortuneStatistics implements Serializable {
this.customerId = customerId;
}
public String getPractitionerId() {
public Long getPractitionerId() {
return practitionerId;
}
public void setPractitionerId(String practitionerId) {
public void setPractitionerId(Long 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.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 经纪人(或团队长)商机目标设定
*/
@Data
public class MktLeadsGoals {
public class MktLeadsGoals implements Serializable {
/**
* serial id
*/
......@@ -95,4 +93,6 @@ public class MktLeadsGoals {
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
......@@ -44,4 +44,6 @@ public interface AclPractitionerMapper {
List<AclPractitioner> findForSubordinateIdByPractitionerId(Long practitionerId);
List<PlayerSalesActivityInfo> playerSalesActivityQuery(@Param("practitionerId") Long practitionerId,@Param("optionsId") Long optionsId);
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;
import com.yd.dal.entity.customer.AclPractitionerSubordinateSystem;
import com.yd.dal.entity.customer.practitioner.PractitionerSubordinateInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.List;
......@@ -23,4 +26,6 @@ public interface AclPractitionerSubordinateSystemMapper {
AclPractitionerSubordinateSystem findByPractitionerId(Long practitionerId);
List<AclPractitionerSubordinateSystem> findByOwnerPractitionerId(Long practitionerId);
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;
import com.yd.dal.entity.marketing.MktLeadsGoals;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MktLeadsGoalsMapper {
int deleteByPrimaryKey(Long id);
......@@ -20,4 +23,6 @@ public interface MktLeadsGoalsMapper {
List<MktLeadsGoals> selectByMktLeadsGoals(MktLeadsGoals mktLeadsGoals);
List<MktLeadsGoals> selectByPractitionerIds(@Param("practitionerIds") List<Long> practitionerIds,@Param("year") Integer year);
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);
}
......@@ -96,4 +96,10 @@ public interface AclPractitionerDALService {
* @return
*/
List<PlayerSalesActivityInfo> playerSalesActivityQuery(Long practitionerId, Long optionsId);
/**
* 根据体系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);
}
......@@ -10,7 +10,11 @@ import java.util.List;
public interface AclPractitionerSubordinateSystemDALService {
PractitionerSubordinateInfo findSubordinateInfo(Long subordinateId);
AclPractitionerSubordinateSystem findByPractitionerId(Long practitionerId);
List<AclPractitionerSubordinateSystem> findByOwnerPractitionerId(Long practitionerId);
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);
}
}
......@@ -96,6 +96,10 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService
@Override
public List<PlayerSalesActivityInfo> playerSalesActivityQuery(Long practitionerId, Long optionsId) {
return aclPractitionerMapper.playerSalesActivityQuery(practitionerId,optionsId);
return aclPractitionerMapper.playerSalesActivityQuery(practitionerId, optionsId);
}
@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);
}
}
......@@ -36,4 +36,8 @@ public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPracti
public List<AclPractitionerSubordinateSystem> findByOwnerPractitionerId(Long practitionerId) {
return aclPractitionerSubordinateSystemMapper.findByOwnerPractitionerId(practitionerId);
}
@Override
public List<AclPractitionerSubordinateSystem> findByOwner(Long practitionerId) {
return aclPractitionerSubordinateSystemMapper.findByOwner(practitionerId);
}
}
......@@ -4,10 +4,7 @@ import com.yd.dal.entity.marketing.MktLeadsGoals;
import com.yd.dal.mapper.marketing.MktLeadsGoalsMapper;
import com.yd.dal.service.marketing.MktLeadsGoalsDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
@Service("mktLeadsGoalsDALService")
......@@ -36,4 +33,8 @@ public class MktLeadsGoalsDALServiceImpl implements MktLeadsGoalsDALService {
return mktLeadsGoalsMapper.selectByPractitionerIds( practitionerIds, year);
}
@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.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
@Service("mktLeadsGoalsDALService")
public interface MktLeadsGoalsDALService {
void saveMktLeadsGoals(MktLeadsGoals mktLeadsGoals);
......@@ -14,4 +13,6 @@ public interface MktLeadsGoalsDALService {
List<MktLeadsGoals> findByMktLeadsGoals(MktLeadsGoals mktLeadsGoals);
List<MktLeadsGoals> selectByPractitionerIds(List<Long> practitionerIds, int year);
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
......@@ -758,4 +758,10 @@
group by p.id
order by scoreDay desc ,scoreWeek desc ,scoreMonth desc ,addOpportunityNum desc
</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>
\ 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
......@@ -254,4 +254,10 @@
from ag_acl_practitioner_subordinate_system
where owner_practitioner_id = #{practitionerId,jdbcType=BIGINT}
</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>
\ No newline at end of file
......@@ -2,8 +2,6 @@
<!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">
<!--@mbg.generated-->
<!--@Table ag_mkt_leads_goals-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="goals_type" jdbcType="INTEGER" property="goalsType" />
<result column="practitioner_id" jdbcType="BIGINT" property="practitionerId" />
......@@ -24,25 +22,21 @@
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
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">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from ag_mkt_leads_goals
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
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">
<!--@mbg.generated-->
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,
......@@ -50,15 +44,13 @@
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},
#{subordinateSystemName,jdbcType=VARCHAR}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit,jdbcType=INTEGER},
#{seqTime,jdbcType=INTEGER}, #{premium,jdbcType=DECIMAL}, #{commission,jdbcType=DECIMAL},
#{pieces,jdbcType=INTEGER}, #{pieceAveragePremium,jdbcType=DECIMAL}, #{currentVersion,jdbcType=TIMESTAMP},
#{pieces,jdbcType=INTEGER}, #{pieceAveragePremium,jdbcType=DECIMAL}, #{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">
<!--@mbg.generated-->
insert into ag_mkt_leads_goals
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="goalsType != null">
goals_type,
......@@ -167,7 +159,6 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.marketing.MktLeadsGoals">
<!--@mbg.generated-->
update ag_mkt_leads_goals
<set>
<if test="goalsType != null">
......@@ -225,7 +216,6 @@
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.marketing.MktLeadsGoals">
<!--@mbg.generated-->
update ag_mkt_leads_goals
set goals_type = #{goalsType,jdbcType=INTEGER},
practitioner_id = #{practitionerId,jdbcType=BIGINT},
......@@ -327,4 +317,13 @@
and current_year = #{year,jdbcType=INTEGER}
and goals_type = 1
</select>
<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