Commit f03c615b authored by libin's avatar libin

Merge branch 'order_received_statistics' into dev

parents 6e53bbe5 59edd8ec
...@@ -17,6 +17,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; ...@@ -17,6 +17,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import java.io.IOException; import java.io.IOException;
...@@ -207,14 +208,24 @@ public class CompanyPerformanceBiz { ...@@ -207,14 +208,24 @@ public class CompanyPerformanceBiz {
pageDataVO.setData(companyPerformanceBos); pageDataVO.setData(companyPerformanceBos);
if (companyPerformanceFindDTO.getPage() == 1) { if (companyPerformanceFindDTO.getPage() == 1) {
OrderReceivedStatistics orderReceivedStatistics = new OrderReceivedStatistics(); Example example = new Example(OrderReceivedStatistics.class);
Example.Criteria criteria = example.createCriteria();
if (Objects.nonNull(companyPerformanceFindDTO.getCompanyId())) { if (Objects.nonNull(companyPerformanceFindDTO.getCompanyId())) {
orderReceivedStatistics.setCompanyId(companyPerformanceFindDTO.getCompanyId()); criteria.andEqualTo("companyId",companyPerformanceFindDTO.getCompanyId());
} }
Long totlCount = orderReceivedStatisticsBiz.selectCount(orderReceivedStatistics); if (Objects.nonNull(companyPerformanceFindDTO.getStartDate()) && Objects.nonNull(companyPerformanceFindDTO.getEndDate())){
long isZero = totlCount % companyPerformanceFindDTO.getLimit(); criteria.andBetween("date",companyPerformanceFindDTO.getStartDate(),companyPerformanceFindDTO.getEndDate());
long totalPage = isZero == 0 ? totlCount / companyPerformanceFindDTO.getLimit() : totlCount / companyPerformanceFindDTO.getLimit() + 1; }
pageDataVO.setTotalCount(totlCount); if (Objects.nonNull(companyPerformanceFindDTO.getStartDate()) && Objects.isNull(companyPerformanceFindDTO.getEndDate())){
criteria.andGreaterThanOrEqualTo("date",companyPerformanceFindDTO.getStartDate());
}
if (Objects.isNull(companyPerformanceFindDTO.getStartDate()) && Objects.nonNull(companyPerformanceFindDTO.getEndDate())){
criteria.andLessThanOrEqualTo("date",companyPerformanceFindDTO.getEndDate());
}
int totalCount = orderReceivedStatisticsBiz.selectCountByExample(example);
long isZero = totalCount % companyPerformanceFindDTO.getLimit();
long totalPage = isZero == 0 ? totalCount / companyPerformanceFindDTO.getLimit() : totalCount / companyPerformanceFindDTO.getLimit() + 1;
pageDataVO.setTotalCount(Long.valueOf(totalCount));
pageDataVO.setTotalPage(Integer.valueOf(String.valueOf(totalPage))); pageDataVO.setTotalPage(Integer.valueOf(String.valueOf(totalPage)));
} }
return pageDataVO; return pageDataVO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment