Commit b6d35e88 by Water Wang

optimize

parent 67186862
package com.yd.dal.mapper.customer; package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomer;import java.util.List; import com.yd.dal.entity.customer.AclCustomer;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AclCustomerMapper { public interface AclCustomerMapper {
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
...@@ -18,4 +21,6 @@ public interface AclCustomerMapper { ...@@ -18,4 +21,6 @@ public interface AclCustomerMapper {
List<AclCustomer> findByLogin(String mobileNo); List<AclCustomer> findByLogin(String mobileNo);
AclCustomer findByMobileNo(String mobileNo); AclCustomer findByMobileNo(String mobileNo);
List<AclCustomer> findByIds(@Param("customerIds") List<Long> customerIds);
} }
\ No newline at end of file
...@@ -46,4 +46,6 @@ public interface AclPractitionerMapper { ...@@ -46,4 +46,6 @@ public interface AclPractitionerMapper {
List<PlayerSalesActivityInfo> playerSalesActivityQuery(@Param("practitionerId") Long practitionerId,@Param("optionsId") Long optionsId); List<PlayerSalesActivityInfo> playerSalesActivityQuery(@Param("practitionerId") Long practitionerId,@Param("optionsId") Long optionsId);
List<AclPractitioner> findBySubordinateSystemId(@Param("subordinateSystemId")Long subordinateSystemId); List<AclPractitioner> findBySubordinateSystemId(@Param("subordinateSystemId")Long subordinateSystemId);
String findMobileNoByPractitionerId(@Param("practitionerId")Long practitionerId);
} }
\ No newline at end of file
...@@ -32,5 +32,7 @@ public interface AclCustomerDALService { ...@@ -32,5 +32,7 @@ public interface AclCustomerDALService {
AclCustomer findByCustomerId(Long customerId); AclCustomer findByCustomerId(Long customerId);
AclCustomer findByMobileNo(String mobileNo); AclCustomer findByMobileNo(String mobileNo);
List<AclCustomer> findByIds(List<Long> customerIds);
} }
...@@ -102,4 +102,11 @@ public interface AclPractitionerDALService { ...@@ -102,4 +102,11 @@ public interface AclPractitionerDALService {
* @return * @return
*/ */
List<AclPractitioner> findBySubordinateSystemId(Long subordinateSystemId); List<AclPractitioner> findBySubordinateSystemId(Long subordinateSystemId);
/**
* 更具经纪人id查询该经纪人手机号码
* @param practitionerId 经纪人id
* @return 查询结果
*/
String findMobileNoByPractitionerId(Long practitionerId);
} }
...@@ -47,4 +47,9 @@ public class AclCustomerDALServiceImpl implements AclCustomerDALService { ...@@ -47,4 +47,9 @@ public class AclCustomerDALServiceImpl implements AclCustomerDALService {
return aclCustomerMapper.findByMobileNo(mobileNo); return aclCustomerMapper.findByMobileNo(mobileNo);
} }
@Override
public List<AclCustomer> findByIds(List<Long> customerIds) {
return aclCustomerMapper.findByIds(customerIds);
}
} }
...@@ -9,6 +9,7 @@ import com.yd.dal.entity.customer.practitioner.PractitionerInfo; ...@@ -9,6 +9,7 @@ import com.yd.dal.entity.customer.practitioner.PractitionerInfo;
import com.yd.dal.entity.customer.practitioner.PractitionerRankInfo; import com.yd.dal.entity.customer.practitioner.PractitionerRankInfo;
import com.yd.dal.mapper.customer.AclPractitionerMapper; import com.yd.dal.mapper.customer.AclPractitionerMapper;
import com.yd.dal.service.customer.AclPractitionerDALService; import com.yd.dal.service.customer.AclPractitionerDALService;
import com.yd.util.deshandler.DESTypeHandler;
import com.yd.util.intercept.annotation.TargetDataSource; import com.yd.util.intercept.annotation.TargetDataSource;
import com.yd.util.intercept.commons.DataSourceKey; import com.yd.util.intercept.commons.DataSourceKey;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
...@@ -102,4 +103,14 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService ...@@ -102,4 +103,14 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService
public List<AclPractitioner> findBySubordinateSystemId(Long subordinateSystemId) { public List<AclPractitioner> findBySubordinateSystemId(Long subordinateSystemId) {
return aclPractitionerMapper.findBySubordinateSystemId(subordinateSystemId); return aclPractitionerMapper.findBySubordinateSystemId(subordinateSystemId);
} }
@Override
public String findMobileNoByPractitionerId(Long practitionerId) {
String mobileNo = aclPractitionerMapper.findMobileNoByPractitionerId(practitionerId);
if(!Strings.isNullOrEmpty(mobileNo)){
DESTypeHandler jpaCryptoConverter = new DESTypeHandler();
mobileNo = jpaCryptoConverter.decode(mobileNo);
}
return mobileNo;
}
} }
...@@ -307,9 +307,9 @@ ...@@ -307,9 +307,9 @@
p.id practitionerId , p.id practitionerId ,
p.`name` name , p.`name` name ,
p.subordinate_system_id subordinateSystemId , p.subordinate_system_id subordinateSystemId ,
COUNT(f.id) count , ifnull(COUNT(f.id),0) count ,
SUM(f.order_price) FYP , ifnull(SUM(f.order_price),0) FYP ,
SUM(f.referral_amount) FYC , ifnull(SUM(f.fyc_amount),0) FYC ,
s.practitioner_level practitionerLevelId s.practitioner_level practitionerLevelId
FROM FROM
((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id) ((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
......
...@@ -771,4 +771,13 @@ ...@@ -771,4 +771,13 @@
from ag_acl_customer from ag_acl_customer
where mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler} where mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler}
</select> </select>
<select id="findByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer
where id in
<foreach collection="customerIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -547,14 +547,14 @@ ...@@ -547,14 +547,14 @@
md.DRP_TITLE_LEVEL as titleCode,-- 职称code md.DRP_TITLE_LEVEL as titleCode,-- 职称code
md.DRP_TITLE_NAME as titleName,-- 职称名称 md.DRP_TITLE_NAME as titleName,-- 职称名称
spc.SPC_DIV_NAME as spcDivName,-- 体系id spc.SPC_DIV_NAME as spcDivName,-- 体系id
count(m.MON025_002) as count,-- 保单id ifnull(count(m.MON025_002),0) as count,-- 保单id
sum(m.MON025_401) as fyp,-- 保费 ifnull(sum(m.MON025_401),0) as fyp,-- 保费
sum(m.MON025_405) as fyc -- 应发佣金 ifnull(sum(policy.INS001_FYCTOTAL),0) as fyc -- 应发佣金
FROM MON025 m INNER JOIN sal001 p on m.MON025_007 = p.SAL_MST_ID -- 业务员id FROM MON025 m INNER JOIN sal001 p on m.MON025_007 = p.SAL_MST_ID -- 业务员id
left join DRP003 md on p.FK_DRP_TITLE_CODE = md.DRP_TITLE_CODE left join DRP003 md on p.FK_DRP_TITLE_CODE = md.DRP_TITLE_CODE
inner JOIN ins001 policy on m.MON025_002 = policy.INS_MST_ID -- 保单id inner JOIN ins001 policy on m.MON025_002 = policy.INS_MST_ID -- 保单id
inner join spc004 spc on m.MON025_006 = spc.SPC_DIV_ID -- 体系 inner join spc004 spc on m.MON025_006 = spc.SPC_DIV_ID -- 体系
WHERE m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 WHERE m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'
<choose> <choose>
<when test="time == 1"> <when test="time == 1">
and DATE_FORMAT(policy.INS_MST_ACCEPT_DATE, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' ) and DATE_FORMAT(policy.INS_MST_ACCEPT_DATE, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
...@@ -575,9 +575,9 @@ ...@@ -575,9 +575,9 @@
p.id as practitionerIdForOnLine , p.id as practitionerIdForOnLine ,
p.name as name ,-- 姓名 p.name as name ,-- 姓名
ss.name as spcDivName,-- 体系id ss.name as spcDivName,-- 体系id
count(f.id) as count,-- 保单id ifnull(count(f.id),0) as count,-- 保单id
sum(f.order_price) as fyp,-- 保费 ifnull(sum(f.order_price),0) as fyp,-- 保费
sum(f.referral_amount) as fyc -- 应发佣金 ifnull(sum(f.fyc_amount),0) as fyc -- 应发佣金
FROM ag_acl_customer_fortune f INNER JOIN ag_po_order o ON f.order_id = o.id FROM ag_acl_customer_fortune f INNER JOIN ag_po_order o ON f.order_id = o.id
inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id
left join ag_acl_practitioner_setting s on p.id = s.practitioner_id left join ag_acl_practitioner_setting s on p.id = s.practitioner_id
...@@ -607,9 +607,9 @@ ...@@ -607,9 +607,9 @@
p.id as practitionerIdForOnLine , p.id as practitionerIdForOnLine ,
p.name as name ,-- 姓名 p.name as name ,-- 姓名
ss.name as spcDivName,-- 体系id ss.name as spcDivName,-- 体系id
count(f.id) as count,-- 保单id ifnull(count(f.id),0) as count,-- 保单id
sum(f.order_price) as fyp,-- 保费 ifnull(sum(f.order_price),0) as fyp,-- 保费
sum(f.referral_amount) as fyc -- 应发佣金 ifnull(sum(f.fyc_amount),0) as fyc -- 应发佣金
FROM ag_acl_customer_fortune f INNER JOIN ag_po_order o ON f.order_id = o.id FROM ag_acl_customer_fortune f INNER JOIN ag_po_order o ON f.order_id = o.id
inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id
left join ag_acl_customer c on p.customer_id = c.id left join ag_acl_customer c on p.customer_id = c.id
...@@ -765,4 +765,9 @@ ...@@ -765,4 +765,9 @@
from ag_acl_practitioner from ag_acl_practitioner
where subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT} and is_active = 1 where subordinate_system_id = #{subordinateSystemId,jdbcType=BIGINT} and is_active = 1
</select> </select>
<select id="findMobileNoByPractitionerId" resultType="java.lang.String">
select c.mobile_no
from ag_acl_practitioner p left join ag_acl_customer c on p.customer_id = c.id and c.is_active = 1
where p.id = #{practitionerId,jdbcType=BIGINT} limit 1;
</select>
</mapper> </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