店铺对应的推广用户

master
wangweijia 6 years ago
parent 54c88f3b95
commit 66085d3172

@ -11,8 +11,10 @@ import java.util.Date;
public class OpCustomerDTO {
/**客户id*/
private Long id;
/**客户称*/
/**客户称*/
private String name;
/**客户真实姓名*/
private String vipName;
/**客户唯一标示*/
private String idCard;
/**客户所属店铺名称 X,XX,XXX*/
@ -23,4 +25,6 @@ public class OpCustomerDTO {
private Date birthday;
/**客户手机*/
private String phone;
/**vip手机*/
private String vipPhone;
}

@ -4,6 +4,7 @@ import com.kiisoo.ic.common.BaseController;
import com.kiisoo.ic.customer.CustomerService;
import com.kiisoo.ic.customer.bean.OpCustomerDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -11,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -29,9 +32,15 @@ public class CustomerController extends BaseController {
@ResponseBody
@PostMapping("/info")
public Map<String, Object> getCustomerInfo(@Param("userId") long userId, Long shopId, Long regionId , Long sellerId,
@Param("startDate") Date startDate, @Param("endDate") Date endDate){
List<OpCustomerDTO> opCustomerDTOS = customerService.getCustomerByUserAndDate(userId, shopId, regionId, sellerId, startDate, endDate);
String startDate, String endDate){
SimpleDateFormat sdf = new SimpleDateFormat();
List<OpCustomerDTO> opCustomerDTOS = null;
try {
opCustomerDTOS = customerService.getCustomerByUserAndDate(userId, shopId, regionId, sellerId,
StringUtils.isBlank(startDate) ? null : sdf.parse(startDate), StringUtils.isBlank(endDate) ? null : sdf.parse(endDate));
} catch (ParseException e) {
log.error("日期转换异常:",e);
}
return data(opCustomerDTOS);
}
}

@ -4,6 +4,7 @@ import com.kiisoo.ic.common.DataConstants;
import com.kiisoo.ic.domain.service.PrivilageDomainService;
import com.kiisoo.ic.region.entity.RegionDO;
import com.kiisoo.ic.region.mapper.RegionDOMapper;
import com.kiisoo.ic.store.bean.PoiStoreStaffDTO;
import com.kiisoo.ic.store.entity.PoiStore;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
@ -52,7 +53,7 @@ public class RegionService {
List<Long> shopsIds = privilageDomainService.listUserDatePermission(userId);
List<PoiStore> shops = poiStoreDOMapper.selectBatchIds(shopsIds);
//找到店铺对应的导购
List<PoiStoreStaff> sellers = poiStoreStaffDOMapper.selectSellersByShopIds(shopsIds);
List<PoiStoreStaffDTO> sellers = poiStoreStaffDOMapper.selectSellersByShopIds(shopsIds);
Map<String, Object> regionAndShop = new HashMap<>();
regionAndShop.put("region", regionDOS);

@ -1,6 +1,7 @@
package com.kiisoo.ic.store.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.store.bean.PoiStoreStaffDTO;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -28,5 +29,5 @@ public interface PoiStoreStaffDOMapper extends BaseMapper<PoiStoreStaff> {
* @param shopId
* @return
*/
List<PoiStoreStaff> selectSellersByShopIds(@Param("shopId") List<Long> shopId);
List<PoiStoreStaffDTO> selectSellersByShopIds(@Param("shopId") List<Long> shopId);
}

@ -1,6 +1,7 @@
package com.kiisoo.ic.store.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kiisoo.ic.store.bean.PoiStoreStaffDTO;
import com.kiisoo.ic.store.entity.PoiStore;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
@ -35,8 +36,8 @@ public class PoiStoreService {
* id
* @param shopId id
*/
public List<PoiStoreStaff> getShopSeller(List<Long> shopId){
List<PoiStoreStaff> sellers = poiStoreStaffDOMapper.selectSellersByShopIds(shopId);
public List<PoiStoreStaffDTO> getShopSeller(List<Long> shopId){
List<PoiStoreStaffDTO> sellers = poiStoreStaffDOMapper.selectSellersByShopIds(shopId);
return sellers;
}

@ -4,7 +4,10 @@
<select id="selectCustomerInfoByShopIds" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
select
t2.id,t2.`name`,t2.member_id as idCard,GROUP_CONCAT(DISTINCT t0.`name`) as shopName, GROUP_CONCAT(DISTINCT t4.`name`) as sellerName, t3.birthday, t2.phone
t2.id,t2.`name`,
t2.member_id as idCard,GROUP_CONCAT(DISTINCT t0.`name`) as shopName,
GROUP_CONCAT(DISTINCT t4.`name`) as sellerName, t3.birthday, t2.phone,
t3.name as vipName,t3.phone as vipPhone
from
poi_store t0,
op_seller_customer_relation t1 LEFT JOIN privilage_user t4 on t1.user_id = t4.id,
@ -21,20 +24,31 @@
and 1 = 0
</otherwise>
</choose>
and t1.create_time BETWEEN #{startDate} and #{endDate}
<if test="startDate != null">
and t1.create_time >= #{startDate}
</if>
<if test="endDate != null">
and t1.create_time <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY t2.id
order by t2.id asc
</select>
<select id="selectCustomerInfoBySellerId" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
select
t2.id,t2.`name`,t2.member_id as idCard,GROUP_CONCAT(DISTINCT t0.`name`) as shopName, GROUP_CONCAT(DISTINCT t4.`name`) as sellerName, t3.birthday, t2.phone
,t3.name as vipName,t3.phone as vipPhone
from
poi_store t0,
op_seller_customer_relation t1 LEFT JOIN privilage_user t4 on t1.user_id = t4.id,
op_customer t2 LEFT JOIN op_vip t3 on t2.member_id = t3.id
where t0.id = t1.store_id and t1.customer_id = t2.id
and t1.user_id = #{sellerId}
and t1.create_time BETWEEN #{startDate} and #{endDate}
<if test="startDate != null">
and t1.create_time >= #{startDate}
</if>
<if test="endDate != null">
and t1.create_time <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY t2.id
order by t2.id asc
</select>

Loading…
Cancel
Save