大屏接口

dev_0531
yechenhao 5 years ago
parent bda3ac0fac
commit 9af471035a

@ -612,30 +612,38 @@ public class StorePromotionDataService {
public void distinctCustomer(HttpServletResponse response) throws IOException {
List<Map<String,Object>> customerIds = storePromotionDataDOMapper.selectDistinctCustomer();
List<CustomerDistinctDTO> customerDistinctDTOS = new ArrayList<>();
Map<Long,PrivilageOrganizational> storeCompanyMap = new HashMap<>();
customerIds.forEach(customerId ->{
QueryWrapper<OpSellerCustomerRelation> relationQw = new QueryWrapper<>();
relationQw.eq("customer_id",customerId.get("customerId")).ne("type",3);
List<OpSellerCustomerRelation> opSellerCustomerRelations = opSellerCustomerRelationDOMapper.selectList(relationQw);
OpCustomer customer = opCustomerDOMapper.selectById((Serializable) customerId.get("customerId"));
opSellerCustomerRelations.forEach(opSellerCustomerRelation -> {
CustomerDistinctDTO customerDistinctDTO = new CustomerDistinctDTO();
customerDistinctDTO.setCount((Long) customerId.get("count"));
PoiStore poiStore = poiStoreDOMapper.selectById(opSellerCustomerRelation.getStoreId());
customerDistinctDTO.setStoreName(poiStore.getName());
customerDistinctDTO.setStoreCode(poiStore.getCode());
Long orgCustomerId = privilageDomainEntityDOMapper.selectDomainIdByShopEntity(poiStore.getId());
if (orgCustomerId != null) {
PrivilageOrganizational orgCustomer = retailCompanyMapper.selectById(orgCustomerId);
PrivilageOrganizational company = retailCompanyMapper.selectById(orgCustomer.getParentId());
if (storeCompanyMap.get(poiStore.getId())!=null){
PrivilageOrganizational company = storeCompanyMap.get(poiStore.getId());
customerDistinctDTO.setCompanyName(company.getName());
customerDistinctDTO.setCompanyCode(company.getCode());
}else{
Long orgCustomerId = privilageDomainEntityDOMapper.selectDomainIdByShopEntity(poiStore.getId());
if (orgCustomerId != null) {
PrivilageOrganizational orgCustomer = retailCompanyMapper.selectById(orgCustomerId);
PrivilageOrganizational company = retailCompanyMapper.selectById(orgCustomer.getParentId());
customerDistinctDTO.setCompanyName(company.getName());
customerDistinctDTO.setCompanyCode(company.getCode());
storeCompanyMap.put(poiStore.getId(),company);
}
}
customerDistinctDTO.setStoreId(opSellerCustomerRelation.getStoreId());
customerDistinctDTO.setCustomerId(opSellerCustomerRelation.getCustomerId());
customerDistinctDTO.setCustomerName(customer.getName());
customerDistinctDTO.setCustomerUserId(customer.getExternalUserid());
customerDistinctDTO.setCustomerName((String)customerId.get("customerName"));
customerDistinctDTO.setCustomerUserId((String)customerId.get("customerUserId"));
customerDistinctDTOS.add(customerDistinctDTO);
});
});

@ -411,13 +411,13 @@
</select>
<select id="selectDistinctCustomer" resultType="Map">
SELECT
customer_id as customerId,count( store_id ) as count
t1.customer_id as customerId,t2.name as customerName,t2.external_userid as customerUserId,t1.count( store_id ) as count
FROM
op_seller_customer_relation
op_seller_customer_relation t1 left join op_customer t2 on t1.customer_id = t2.id
GROUP BY
customer_id
t1.customer_id
HAVING
count( store_id ) > 1;
count( t1.store_id ) > 1;
</select>

Loading…
Cancel
Save