修改好友列表数据不一致问题。

dev_0531
kevin jiang 6 years ago
parent 6c978ab26e
commit 829d189285

@ -31,7 +31,9 @@ import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper;
import com.kiisoo.ic.store.service.PoiStoreService;
import com.kiisoo.ic.synchronous.entity.TurnBackDTO;
import com.kiisoo.ic.system.entity.PrivilageUserDO;
import com.kiisoo.ic.system.enums.RoleEnum;
import com.kiisoo.ic.system.mapper.PrivilageUserDOMapper;
import com.kiisoo.ic.webappmy.vo.StafferInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
@ -90,6 +92,10 @@ public class CustomerService {
@Autowired
private CustomerViewService customerViewService;
@Autowired
public PrivilageUserDOMapper privilageUserDOMapper;
/**
* token
*/
@ -326,9 +332,10 @@ public class CustomerService {
/**
*
*
* @param opCustomer
* @param staffCode Code
* @param opCustomer
* @param joinTime
* @param shopId
* @param sellerId
*/
@Transactional(rollbackFor = Exception.class)
public void sellerCustomerRelation(OpCustomer opCustomer, Date joinTime, long shopId, long sellerId) {
@ -543,6 +550,22 @@ public class CustomerService {
}else{
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopIdAndDate(shopId, sellerId, search, startDate, endDate, type);
}
if(CollectionUtils.isNotEmpty(thisList)){
for (int i = 0; i < thisList.size(); i++) {
// 设置导购名称
if(!thisList.get(i).getInviteSellerId().equals(0L)){
Map<String, Object> map = new HashMap<>();
map.put("id", thisList.get(i).getInviteSellerId());
String userName = poiStoreStaffDOMapper.selectUserNameById(thisList.get(i).getInviteSellerId());
if(StringUtils.isNotEmpty(userName)){
thisList.get(i).setInviteSellerName(userName);
}
}else{
thisList.get(i).setInviteSellerName("");
}
}
}
} else {
// 0、新增好友 1、累计好友
if(flag == 0){
@ -551,8 +574,8 @@ public class CustomerService {
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySellerAndDate(userId, search, startDate, endDate, type);
}
}
results.put("this", new PageInfo<>(thisList));
results.put("this", new PageInfo<>(thisList));
return results;
}

@ -57,4 +57,7 @@ public interface PoiStoreStaffDOMapper extends BaseMapper<PoiStoreStaff> {
Long selectStaffIdByUserId(@Param("userId") Long userId);
Long selectStaffIdByTag(@Param("storeId") Long store,@Param("tag") String tag);
String selectUserNameById(@Param("id") Long id);
}

@ -115,10 +115,16 @@ public class StoreEmployeeService {
private String cancelQrCode;
/**
*
*
* @param storeId id
* @param regionId id
* 广-
* @param userId ID
* @param storeId ID
* @param bigRegionId ID
* @param companyId ID
* @param pageNum
* @param pageSize
* @param code
* @return
* @throws Exception
*/
public PageInfo<StoreUserDTO> listStoreUser(Long userId, Long storeId, Long bigRegionId, Long companyId, Integer pageNum, Integer pageSize, String code) throws Exception {
Map<String, Object> result = new HashMap<>();

@ -46,22 +46,19 @@
</select>
<select id="selectFriendListByShopId" resultType="com.kiisoo.ic.customer.bean.FriendDTO">
SELECT DISTINCT
SELECT
t2. NAME AS customerName ,
t2.id AS customerId ,
IFNULL(t3.phone , '') AS mobile ,
t1.user_id AS inviteSellerId ,
t2.create_time AS addTime ,
t2.avatar_url AS avatar ,
t3. LEVEL AS vipFlag,
t5.`name` as inviteSellerName
t3. LEVEL AS vipFlag
FROM
op_seller_customer_relation t1
left join op_customer t2 on t1.customer_id = t2.id
join op_customer t2 on t1.customer_id = t2.id
LEFT JOIN op_vip t3 ON t2.member_id = t3.id
AND t3. STATUS = 1
left JOIN poi_store_staff t4 ON t4.store_id = t1.store_id and t4.id = t1.user_id
left JOIN privilage_user t5 ON t4.user_id = t5.id
WHERE
1 = 1
<if test="type == 1">
@ -87,7 +84,6 @@
<if test="endDate != null">
and date(t1.create_time) &lt;= #{endDate}
</if>
group by t2.id
order by t1.create_time desc
</select>
<!--根据导购id查询导购名-->
@ -134,22 +130,19 @@
</select>
<select id="selectFriendListByShopIdAndDate" resultType="com.kiisoo.ic.customer.bean.FriendDTO">
SELECT DISTINCT
SELECT
t2. NAME AS customerName ,
t2.id AS customerId ,
IFNULL(t3.phone , '') AS mobile ,
t1.user_id AS inviteSellerId ,
t2.create_time AS addTime ,
t2.avatar_url AS avatar ,
t3. LEVEL AS vipFlag,
t5.`name` as inviteSellerName
t3. LEVEL AS vipFlag
FROM
op_seller_customer_relation t1
join op_customer t2 on t1.customer_id = t2.id
LEFT JOIN op_vip t3 ON t2.member_id = t3.id
AND t3. STATUS = 1
JOIN poi_store_staff t4 ON t4.store_id = t1.store_id and t4.id = t1.user_id
JOIN privilage_user t5 ON t4.user_id = t5.id
WHERE
1 = 1
<if test="type == 1">
@ -169,7 +162,6 @@
(t2.name LIKE CONCAT('%',#{search},'%') OR t3.phone LIKE
CONCAT('%',#{search},'%'))
</if>
group by t2.id,t1.user_id
order by t1.create_time desc
</select>

@ -65,4 +65,10 @@
select staff_id from poi_store_staff_tag where store_id = #{storeId} and tag = #{tag}
limit 1
</select>
<select id="selectUserNameById" resultType="java.lang.String">
select t5.name from poi_store_staff t4,
privilage_user t5 where t4.user_id = t5.id and t4.id = #{id}
</select>
</mapper>

Loading…
Cancel
Save