package com.kiisoo.ic.customer.controller; 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; 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; /** * 客户 */ @RestController @RequestMapping("/customer") @Slf4j public class CustomerController extends BaseController { @Autowired private CustomerService customerService; @ResponseBody @PostMapping("/info") public Map getCustomerInfo(@Param("userId") long userId, Long shopId, Long regionId , Long sellerId, String startDate, String endDate){ SimpleDateFormat sdf = new SimpleDateFormat(); List 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); } }