客户明细原型修改

master
wangweijia 6 years ago
parent 4b17c39b3f
commit f6def792b6

@ -14,6 +14,7 @@ import com.kiisoo.ic.customer.mapper.OpCustomerDOMapper;
import com.kiisoo.ic.customer.mapper.OpSellerCustomerRelationDOMapper;
import com.kiisoo.ic.customer.mapper.OpVipDOMapper;
import com.kiisoo.ic.domain.service.PrivilageDomainService;
import com.kiisoo.ic.generalize.service.RetailCompanyService;
import com.kiisoo.ic.store.entity.PoiStore;
import com.kiisoo.ic.store.service.PoiStoreService;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
@ -54,6 +55,8 @@ public class CustomerService {
@Autowired
private PrivilageDomainService privilageDomainService;
@Autowired
private RetailCompanyService retailCompanyService;
@Autowired
public CustomerService(OpCustomerDOMapper opCustomerDOMapper, OpSellerCustomerRelationDOMapper opSellerCustomerRelationDOMapper, OpVipDOMapper opVipDOMapper, PoiStoreDOMapper poiStoreDOMapper, PoiStoreStaffDOMapper poiStoreStaffDOMapper) {
this.opCustomerDOMapper = opCustomerDOMapper;
@ -184,7 +187,7 @@ public class CustomerService {
* id
* @param sellerId
*/
public List<OpCustomerDTO> getCustomerInfoByShopIds(long sellerId, Date startDate, Date endDate){
public List<OpCustomerDTO> getCustomerInfoBySellerId(long sellerId, Date startDate, Date endDate, int pageNum, int pageSize){
List<OpCustomerDTO> customers = opCustomerDOMapper.selectCustomerInfoBySellerId(sellerId, startDate, endDate);
return customers;
}
@ -197,16 +200,16 @@ public class CustomerService {
* @param startDate
* @param endDate
*/
public List<OpCustomerDTO> getCustomerByUserAndDate(long userId,Long shopId, Long regionId , Long sellerId, Date startDate, Date endDate, int pageNum, int pageSize){
public List<OpCustomerDTO> getCustomerByUserAndDate(long userId,Long shopId, Long regionId , Long sellerId, Long companyId, Date startDate, Date endDate, int pageNum, int pageSize){
Set<Long> shopIds = new HashSet<>();
//根据店铺查询所有扫码客户信息
List<OpCustomerDTO> opCustomerDTOS;
//如果有店铺则查店铺
if(sellerId != null){
opCustomerDTOS = getCustomerInfoByShopIds(sellerId, startDate, endDate);
opCustomerDTOS = getCustomerInfoBySellerId(sellerId, startDate, endDate,pageNum,pageSize);
return opCustomerDTOS;
}else if(shopId != null){
//如果有店铺则查店铺
shopIds.add(shopId);
}else if(regionId != null){
//如果有区域则查区域店铺
@ -214,6 +217,12 @@ public class CustomerService {
shopIds = shops.stream().map(p -> p.getId()).collect(Collectors.toSet());
List<Long> userAllShops = privilageDomainService.listUserDatePermission(userId);
shopIds.retainAll(userAllShops);
}else if(companyId != null){
//如果有公司则查公司店铺
List<PoiStore> shops = retailCompanyService.selectShopByCompany(companyId);
shopIds = shops.stream().map(p -> p.getId()).collect(Collectors.toSet());
List<Long> userAllShops = privilageDomainService.listUserDatePermission(userId);
shopIds.retainAll(userAllShops);
}else{
//查询用户权限店铺
shopIds = new HashSet<>(privilageDomainService.listUserDatePermission(userId));

@ -17,10 +17,16 @@ public class OpCustomerDTO {
private String vipName;
/**客户唯一标示*/
private String idCard;
/**客户所属店铺名称 X,XX,XXX*/
/**客户所属店铺名称X*/
private String shopName;
/**客户所属导购名称 X,XX,XXX*/
/**客户所属店铺编码-*/
private String shopCode;
/**客户所属导购名称*/
private String sellerName;
/**客户所属导购工号-*/
private String sellerCode;
/**创建时间-*/
private Date createTime;
/**客户生日*/
private Date birthday;
/**客户手机*/

@ -29,12 +29,12 @@ public class CustomerController extends BaseController {
@ResponseBody
@PostMapping("/info")
public Map<String, Object> getCustomerInfo(@Param("userId") long userId, Long shopId, Long regionId , Long sellerId,
public Map<String, Object> getCustomerInfo(@Param("userId") long userId, Long shopId, Long regionId , Long sellerId, Long companyId,
String startDate, String endDate,@RequestParam("pageNum") int pageNum, @RequestParam("pageSize")int pageSize){
SimpleDateFormat sdf = new SimpleDateFormat();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<OpCustomerDTO> opCustomerDTOS = null;
try {
opCustomerDTOS = customerService.getCustomerByUserAndDate(userId, shopId, regionId, sellerId,
opCustomerDTOS = customerService.getCustomerByUserAndDate(userId, shopId, regionId, sellerId,companyId,
StringUtils.isBlank(startDate) ? null : sdf.parse(startDate), StringUtils.isBlank(endDate) ? null : sdf.parse(endDate) ,pageNum,pageSize);
return data(opCustomerDTOS);

@ -57,7 +57,7 @@ public class PoiSellerService {
}else if(companyId != null){
//有公司就查公司店铺
shopIds = privilageDomainService.listUserDatePermission(userId);
List<PoiStore> stores = retailCompanyService.selectShopByCompany(regionId);
List<PoiStore> stores = retailCompanyService.selectShopByCompany(companyId);
List<Long> regionShopIds = stores.stream().map(i -> i.getId()).collect(Collectors.toList());
shopIds.retainAll(regionShopIds);
}else{

@ -5,12 +5,12 @@
<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,
t3.name as vipName,t3.phone as vipPhone
t2.member_id as idCard,t0.name as shopName,t0.code as shopCode,
t4.name as sellerName, t3.birthday, t2.phone,
t3.name as vipName,t3.phone as vipPhone, t5.staff_code as sellerCode, t1.create_time as createTime
from
poi_store t0,
op_seller_customer_relation t1 LEFT JOIN privilage_user t4 on t1.user_id = t4.id,
op_seller_customer_relation t1 LEFT JOIN privilage_user t4 on t1.user_id = t4.id left join poi_store_staff t5 on t4.id = t5.user_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
<choose>
@ -30,8 +30,7 @@
<if test="endDate != null">
and t1.create_time <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY t2.id
order by t2.id asc
order by t2.id,t1.user_id asc
</select>
<select id="selectCustomerInfoBySellerId" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
select

Loading…
Cancel
Save