|
@@ -23,10 +23,13 @@ import org.springframework.transaction.annotation.Transactional;
|
|
import org.apache.ibatis.session.RowBounds;
|
|
import org.apache.ibatis.session.RowBounds;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
+import tk.mybatis.mapper.util.StringUtil;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Generate Code By Unimall
|
|
* Generate Code By Unimall
|
|
@@ -50,11 +53,49 @@ public class CustomerBillingServiceImpl implements CustomerBillingService {
|
|
@Override
|
|
@Override
|
|
public Page<CustomerBillingInfoDO> list(CustomerBillingInfoDTO selectDTO, Integer page, Integer limit, Long adminId) throws ServiceException {
|
|
public Page<CustomerBillingInfoDO> list(CustomerBillingInfoDTO selectDTO, Integer page, Integer limit, Long adminId) throws ServiceException {
|
|
Wrapper<CustomerBillingInfoDO> wrapper = new EntityWrapper<CustomerBillingInfoDO>();
|
|
Wrapper<CustomerBillingInfoDO> wrapper = new EntityWrapper<CustomerBillingInfoDO>();
|
|
|
|
+ if (!StringUtils.isEmpty(selectDTO.getPayNo())) {
|
|
|
|
+ wrapper.like("pay_no", selectDTO.getPayNo());
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(selectDTO.getBusinessType())) {
|
|
|
|
+ wrapper.eq("business_type", selectDTO.getBusinessType());
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(selectDTO.getStatus())) {
|
|
|
|
+ wrapper.eq("status", selectDTO.getStatus());
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotEmpty(selectDTO.getStartDate())) {
|
|
|
|
+ wrapper.and("DATE_FORMAT(closing_date,'%Y%m%d') >= DATE_FORMAT('" + selectDTO.getStartDate() + "','%Y%m%d')");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotEmpty(selectDTO.getEndDate())) {
|
|
|
|
+ wrapper.and("DATE_FORMAT(closing_date,'%Y%m%d') <= DATE_FORMAT('" + selectDTO.getEndDate() + "','%Y%m%d')");
|
|
|
|
+
|
|
|
|
+ }
|
|
List<CustomerBillingInfoDO> list = customerBillingInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
List<CustomerBillingInfoDO> list = customerBillingInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
Integer count = customerBillingInfoMapper.selectCount(wrapper);
|
|
Integer count = customerBillingInfoMapper.selectCount(wrapper);
|
|
return new Page<CustomerBillingInfoDO>(list, page, limit, count);
|
|
return new Page<CustomerBillingInfoDO>(list, page, limit, count);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<String> customerList() throws ServiceException {
|
|
|
|
+ Wrapper<CustomerBillingInfoDO> wrapper = new EntityWrapper<CustomerBillingInfoDO>();
|
|
|
|
+ wrapper.groupBy("customer");
|
|
|
|
+ List<CustomerBillingInfoDO> list = customerBillingInfoMapper.selectList(wrapper);
|
|
|
|
+ List<String> customer = list.stream().map(CustomerBillingInfoDO::getCustomer).collect(Collectors.toList());
|
|
|
|
+ return customer;
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public List<CustomerBillingInfoDO> cusDate(String customer) throws ServiceException {
|
|
|
|
+ Wrapper<CustomerBillingInfoDO> wrapper = new EntityWrapper<CustomerBillingInfoDO>();
|
|
|
|
+ wrapper.eq("customer",customer);
|
|
|
|
+ List<CustomerBillingInfoDO> list = customerBillingInfoMapper.selectList(wrapper);
|
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
|
+ List<CustomerBillingDetailDO> customerBillingDetailDOS = customerBillingDetailMapper.selectList(new EntityWrapper<CustomerBillingDetailDO>()
|
|
|
|
+ .eq("info_id", list.get(i).getId()));
|
|
|
|
+ list.get(i).setCustomerBillingDetailDOList(customerBillingDetailDOS);
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public CustomerBillingInfoDO create(CustomerBillingInfoDTO insertDTO, Long adminId) throws ServiceException {
|
|
public CustomerBillingInfoDO create(CustomerBillingInfoDTO insertDTO, Long adminId) throws ServiceException {
|