master
jiangyunjie 6 years ago
parent 8bdf0b4a88
commit 9d939e1c43

@ -435,21 +435,21 @@ public class CustomerService {
Date lastDate = dateFormat.parse(dateFormat.format(calendar.getTime()));
calendar.set(Calendar.HOUR_OF_DAY, -24);
Date earlyDate = dateFormat.parse(dateFormat.format(calendar.getTime()));
List<StafferInfoVO> stafferInfoVOS = poiStoreStaffDOMapper.selectInfoById(userId);
Long shopId = stafferInfoVOS.get(0).getStoreId();
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
List<StafferInfoVO> stafferInfoVOS = poiStoreStaffDOMapper.selectInfoById(userId);
Long shopId = stafferInfoVOS.get(0).getStoreId();
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId, null, sellerId, search, thisDate, thisDate, type);
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, thisDate, thisDate, type);
results.put("this", thisList);
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId, null, sellerId, search, lastDate, lastDate, type);
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, lastDate, lastDate, type);
results.put("last", lastList);
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId, null, sellerId, search, null, earlyDate, type);
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, null, earlyDate, type);
results.put("early", earlyList);
} else {
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(null, userId, null, search, thisDate, thisDate, type);
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(sellerId, search, thisDate, thisDate, type);
results.put("this", thisList);
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(null, userId, null, search, lastDate, lastDate, type);
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(sellerId, search, lastDate, lastDate, type);
results.put("last", lastList);
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(null, userId, null, search, null, earlyDate, type);
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(sellerId, search, null, earlyDate, type);
results.put("early", earlyList);
}
return results;

@ -16,10 +16,24 @@ import java.util.Map;
@Repository
public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCustomerRelation> {
/**
*
* @param sellerId
* @param search
* @param startDate
* @param endDate
* @param type
* @return
*/
List<FriendDTO> selectFriendListBySeller(@Param("sellerId") Long sellerId,
@Param("search") String search,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("type") Integer type);
/**
*
* @param shopId
* @param userId
* @param sellerId
* @param search
* @param startDate
@ -27,8 +41,7 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCus
* @param type
* @return
*/
List<FriendDTO> selectShopListByDate(@Param("shopId") Long shopId,
@Param("userId") Long userId,
List<FriendDTO> selectFriendListByShopId(@Param("shopId") Long shopId,
@Param("sellerId") Long sellerId,
@Param("search") String search,
@Param("startDate") Date startDate,

@ -1,7 +1,7 @@
<?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.kiisoo.ic.customer.mapper.OpSellerCustomerRelationDOMapper">
<select id="selectShopListByDate" resultType="com.kiisoo.ic.customer.bean.FriendDTO">
<select id="selectFriendListBySeller" resultType="com.kiisoo.ic.customer.bean.FriendDTO">
SELECT
DISTINCT
t2.NAME AS customerName,
@ -28,8 +28,45 @@
<if test="type == 2">
and t3.id is null
</if>
<if test="userId != null">
and t1.user_id = #{userId}
<if test="sellerId != null and sellerId != 0">
and t4.user_id = #{sellerId}
</if>
<if test="search != null and search !=''">
and
CONCAT(IFNULL(t2.name,''),IFNULL(t2.phone,''))
LIKE CONCAT('%',#{search},'%')
</if>
<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>
order by t1.create_time desc
</select>
<select id="selectFriendListByShopId" resultType="com.kiisoo.ic.customer.bean.FriendDTO">
SELECT
DISTINCT
t2.NAME AS customerName,
t2.id AS customerId,
t2.phone AS mobile,
t4.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
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>
<if test="type == 2">
and t3.id is null
</if>
<if test="shopId != null">
and t1.store_id = #{shopId}

@ -376,7 +376,7 @@
GROUP BY
storeId
ORDER BY
newCusNum, storeId DESC
newCusNum DESC
) a,
( SELECT @rank := 0 ) b
</select>
@ -397,7 +397,7 @@
</if>
where t1.store_id = #{storeId}
and t1.type = 4
GROUP BY userId ORDER BY newCusNum, userId DESC ) a,
GROUP BY userId ORDER BY newCusNum DESC ) a,
( SELECT @rank := 0 ) b
</select>
<select id="selectLatestUpdateTime" resultType="java.util.Date">

Loading…
Cancel
Save