|
|
|
@ -32,6 +32,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
@ -399,25 +401,30 @@ public class CustomerService {
|
|
|
|
|
* @param search
|
|
|
|
|
* @param roleCode
|
|
|
|
|
*/
|
|
|
|
|
public Map<String,Object> listCustomer(Long userId,Long sellerId,String search,String roleCode){
|
|
|
|
|
public Map<String,Object> listCustomer(Long userId,Long sellerId,String search,String roleCode, Integer type) throws Exception{
|
|
|
|
|
Map<String,Object> results = new HashMap<>();
|
|
|
|
|
Date thisDate = new Date();
|
|
|
|
|
Date lastDate = new Date();
|
|
|
|
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, -24);
|
|
|
|
|
Date lastDate = dateFormat.parse(dateFormat.format(calendar.getTime()));
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, -24);
|
|
|
|
|
Date earlyDate = dateFormat.parse(dateFormat.format(calendar.getTime()));
|
|
|
|
|
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);
|
|
|
|
|
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,thisDate,thisDate, type);
|
|
|
|
|
results.put("this",thisList);
|
|
|
|
|
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,lastDate,lastDate);
|
|
|
|
|
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,lastDate,lastDate, type);
|
|
|
|
|
results.put("last",lastList);
|
|
|
|
|
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,null,lastDate);
|
|
|
|
|
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,null,earlyDate, type);
|
|
|
|
|
results.put("early",earlyList);
|
|
|
|
|
}else{
|
|
|
|
|
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,thisDate,thisDate);
|
|
|
|
|
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,thisDate,thisDate, type);
|
|
|
|
|
results.put("this",thisList);
|
|
|
|
|
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,lastDate,lastDate);
|
|
|
|
|
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,lastDate,lastDate, type);
|
|
|
|
|
results.put("last",lastList);
|
|
|
|
|
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,null,lastDate);
|
|
|
|
|
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,null,earlyDate, type);
|
|
|
|
|
results.put("early",earlyList);
|
|
|
|
|
}
|
|
|
|
|
return results;
|
|
|
|
|