master
jiangyunjie 6 years ago
parent b06fcfe479
commit e1c5519ee7

@ -33,6 +33,7 @@ import com.kiisoo.ic.synchronous.entity.VipDataDTO;
import com.kiisoo.ic.system.enums.RoleEnum;
import com.kiisoo.ic.webappmy.vo.StafferInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -439,10 +440,28 @@ public class CustomerService {
Long shopId = stafferInfoVOS.get(0).getStoreId();
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, thisDate, thisDate, type);
results.put("this", thisList);
thisList.forEach(friendDTO -> {
String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
if (StringUtils.isNotBlank(inviteSellerName)) {
friendDTO.setInviteSellerName(inviteSellerName);
}
});
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, lastDate, lastDate, type);
results.put("last", lastList);
lastList.forEach(friendDTO -> {
String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
if (StringUtils.isNotBlank(inviteSellerName)) {
friendDTO.setInviteSellerName(inviteSellerName);
}
});
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, null, earlyDate, type);
earlyList.forEach(friendDTO -> {
String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
if (StringUtils.isNotBlank(inviteSellerName)) {
friendDTO.setInviteSellerName(inviteSellerName);
}
});
results.put("this", thisList);
results.put("last", lastList);
results.put("early", earlyList);
} else {
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, thisDate, thisDate, type);

@ -37,7 +37,7 @@ public class FriendDTO {
/**
* id
*/
private String inviteSellerId;
private Long inviteSellerId;
/**
*

@ -48,6 +48,13 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCus
@Param("endDate") Date endDate,
@Param("type") Integer type);
/**
* id
* @param id
* @return
*/
String selectStaffName(@Param("id") Long id);
List<Map<String, Object>> selectAllCustomer(@Param("ids") List<Long> ids);
List<Map<String, Object>> selectAllCustomer1(@Param("ids") List<Long> ids);

@ -135,19 +135,25 @@ public interface StorePromotionDataDOMapper {
@Param("endDate") Date endDate);
/**
*
* @param userId
* ()
* @param storeId
* @param startDate
* @param endDate
* @param type Type 1.()2.
* @return
*/
Integer selectWxSumCusNumByCondition(@Param("userId") Long userId,
@Param("storeId") Long storeId,
Integer selectWxSumCusNumByConditionShopManager(@Param("storeId") Long storeId,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("type") Integer type);
@Param("endDate") Date endDate);
/**
* ()
* @param userId
* @param startDate
* @param endDate
* @return
*/
Integer selectWxSumCusNumByConditionStaff(@Param("userId") Long userId,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
/**
* id

@ -327,9 +327,9 @@ public class StorePromotionDataService {
switch (roleCode) {
// 店长
case Constants.WX_USER_ROLE_SHOP_MANAGER:
cusNum = storePromotionDataDOMapper.selectWxSumCusNumByCondition(null, storeId, null, null, null);
newCusNum = storePromotionDataDOMapper.selectWxSumCusNumByCondition(null, storeId, startDate, endDate, null);
newCusNumLast = storePromotionDataDOMapper.selectWxSumCusNumByCondition(null, storeId, lastStartDate, lastEndDate, null);
cusNum = storePromotionDataDOMapper.selectWxSumCusNumByConditionShopManager(storeId, null, null);
newCusNum = storePromotionDataDOMapper.selectWxSumCusNumByConditionShopManager(storeId, startDate, endDate);
newCusNumLast = storePromotionDataDOMapper.selectWxSumCusNumByConditionShopManager(storeId, lastStartDate, lastEndDate);
// 店铺排名
List<StorePromotionDataDO> storeRankNoList = storePromotionDataDOMapper.selectStoreRankNo(startDate, endDate);
if (CollectionUtils.isNotEmpty(storeRankNoList)) {
@ -372,9 +372,9 @@ public class StorePromotionDataService {
break;
// 导购
case Constants.WX_USER_ROLE_STAFF:
cusNum = storePromotionDataDOMapper.selectWxSumCusNumByCondition(userId, null, null, null, null);
newCusNum = storePromotionDataDOMapper.selectWxSumCusNumByCondition(userId, null, startDate, endDate, null);
newCusNumLast = storePromotionDataDOMapper.selectWxSumCusNumByCondition(userId, null, lastStartDate, lastEndDate, null);
cusNum = storePromotionDataDOMapper.selectWxSumCusNumByConditionStaff(userId, null, null);
newCusNum = storePromotionDataDOMapper.selectWxSumCusNumByConditionStaff(userId, startDate, endDate);
newCusNumLast = storePromotionDataDOMapper.selectWxSumCusNumByConditionStaff(userId, lastStartDate, lastEndDate);
// 店铺排名
List<StorePromotionDataDO> staffRankNoList = storePromotionDataDOMapper.selectStaffRankNo(startDate, endDate, storeId);
if (CollectionUtils.isNotEmpty(staffRankNoList)) {

@ -8,7 +8,7 @@
t2.id AS customerId,
t2.phone AS mobile,
t5.NAME AS inviteSellerName,
t4.user_id AS inviteSellerId,
t4.id AS inviteSellerId,
t1.create_time AS addTime,
t2.avatar_url as avatar,
t3.level as vipFlag
@ -19,8 +19,8 @@
privilage_user t5
WHERE
t1.customer_id = t2.id
AND t1.user_id = t5.id
AND t1.user_id = t4.user_id
AND t1.user_id = t4.id
AND t4.user_id = t5.id
AND t1.store_id = t4.store_id
<if test="type == 1">
and t3.id is not null
@ -50,18 +50,15 @@
t2.NAME AS customerName,
t2.id AS customerId,
t2.phone AS mobile,
t4.user_id AS inviteSellerId,
t1.user_id AS inviteSellerId,
t1.create_time AS addTime,
t2.avatar_url as avatar,
t3.level as vipFlag
FROM
op_seller_customer_relation t1,
op_customer t2 left join op_vip t3 on t2.member_id = t3.id and t3.status = 1,
poi_store_staff t4
op_customer t2 left join op_vip t3 on t2.member_id = t3.id and t3.status = 1
WHERE
t1.customer_id = t2.id
AND t1.user_id = t4.user_id
AND t1.store_id = t4.store_id
<if test="type == 1">
and t3.id is not null
</if>
@ -72,7 +69,7 @@
and t1.store_id = #{shopId}
</if>
<if test="sellerId != null and sellerId != 0">
and t4.user_id = #{sellerId}
and t1.user_id = #{sellerId}
</if>
<if test="search != null and search !=''">
and
@ -87,6 +84,10 @@
</if>
order by t1.create_time desc
</select>
<!--根据导购id查询导购名-->
<select id="selectStaffName" resultType="java.lang.String">
SELECT t1.NAME from privilage_user t1, poi_store_staff t2 where t1.id = t2.user_id AND t2.id = #{id} AND t2.type = 4
</select>
<select id="selectAllCustomer" resultType="java.util.Map">
select user_id,count(0) as count from op_seller_customer_relation
where 1 = 1

@ -289,30 +289,31 @@
group by store_id
</select>
<select id="selectWxSumCusNumByCondition" resultType="java.lang.Integer">
<select id="selectWxSumCusNumByConditionShopManager" resultType="java.lang.Integer">
SELECT count(customer_id) from op_seller_customer_relation
where 1 = 1
<if test="userId != null">
AND user_id = #{userId}
</if>
<if test="storeId != null">
AND store_id = #{storeId}
</if>
WHERE store_id = #{storeId}
<if test="startDate != null">
and DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d')
</if>
<if test="endDate != null">
and DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d')
</if>
<if test="type != null">
AND `type` = #{type}
</if>
group by store_id
</select>
<select id="selectWxSumCusNumByConditionStaff" resultType="java.lang.Integer">
SELECT count(customer_id) from op_seller_customer_relation t1, poi_store_staff t2 where t1.user_id = t2.id
and t2.type = 4
<if test="userId != null">
group by user_id
AND t2.user_id = #{userId}
</if>
<if test="storeId != null">
group by store_id
<if test="startDate != null">
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d')
</if>
<if test="endDate != null">
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d')
</if>
group by t1.user_id
</select>
<select id="selectStoreIdByUserId" resultType="java.lang.Long">
@ -339,7 +340,7 @@
<select id="selectWxValidStaffNameList" resultType="com.kiisoo.ic.store.entity.StaffDO">
SELECT
DISTINCT
t1.user_id as id,
t1.id as id,
t2.NAME AS staffName
FROM
poi_store_staff t1,
@ -388,7 +389,7 @@
FROM
( SELECT count( t2.customer_id ) AS newCusNum, t1.user_id AS userId FROM
poi_store_staff t1
LEFT JOIN `op_seller_customer_relation` t2 ON t1.user_id = t2.user_id
LEFT JOIN `op_seller_customer_relation` t2 ON t1.id = t2.user_id
<if test="startDate != null">
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d')
</if>

Loading…
Cancel
Save