Commit f6dddfd6 authored by jiaorz's avatar jiaorz

Merge branch 'master-vehicle-count-bug' into dev

# Conflicts:
#	xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/impl/UploadZipServiceImpl.java
#	xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
parents 3804d4be ce3dbc1a
......@@ -97,10 +97,22 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
......@@ -142,6 +154,11 @@
<version>3.11.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -26,6 +26,12 @@
<groupId>com.github.wxiaoqi</groupId>
<artifactId>ace-common</artifactId>
<version>2.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
......@@ -92,5 +98,11 @@
<artifactId>xxl-job-core</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -382,9 +382,9 @@ public class BackStageOrderController extends CommonBaseController implements Us
return ObjectRestResponse.paramIsEmpty();
}
if(flag != null && flag == true) {
return baseOrderBiz.getOrderDetail(orderNo, userDTO);
} else {
return baseOrderBiz.orderDetail(orderNo, userDTO);
} else {
return baseOrderBiz.getOrderDetail(orderNo, userDTO);
}
}
......
......@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
......@@ -120,4 +121,33 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
return ObjectRestResponse.succ(new PageDataVO<>());
}
public List<BranchCompanyVehicleCountVo> exportAllDate(BranchCompanyVehicleCountDTO branchCompanyVehicleCountDTO) {
if (StringUtils.isBlank(branchCompanyVehicleCountDTO.getStartTime()) || StringUtils.isBlank(branchCompanyVehicleCountDTO.getEndTime())) {
branchCompanyVehicleCountDTO.setStartTime(DateTime.now().minusDays(1).toString(DATE_TIME_FORMATTER));
branchCompanyVehicleCountDTO.setEndTime(DateTime.now().minusDays(1).toString(DATE_TIME_FORMATTER));
}
Integer type = branchCompanyVehicleCountDTO.getType() == null ? 1 : branchCompanyVehicleCountDTO.getType();
Query query = new Query(branchCompanyVehicleCountDTO);
if (type == 1) {//按天
return mapper.getAllCountInfo(query.getSuper());
}
if (type == 2) {//按周
List<BranchCompanyVehicleCountVo> pageDataVO = mapper.countByWeek(query.getSuper());
if (pageDataVO != null && pageDataVO.size() > 0) {
pageDataVO.parallelStream().forEach(result -> {
String weekStartDate = OrderDateUtils.getStartDayOfWeekNo(result.getCountYear(), result.getCountWeek());
String weekEndDate = OrderDateUtils.getEndDayOfWeekNo(result.getCountYear(), result.getCountWeek());
result.setWeekStartDate(weekStartDate);
result.setWeekEndDate(weekEndDate);
});
}
return pageDataVO;
}
if (type == 3) {//按月
return mapper.countByMonth(query.getSuper());
}
return new ArrayList<>();
}
}
......@@ -123,7 +123,8 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
DateTime startDay = DateTime.parse(startDate, DEFAULT_DATE_TIME_FORMATTER);
DateTime endDay = DateTime.parse(endDate, DEFAULT_DATE_TIME_FORMATTER);
int i = 0;
for (DateTime curDate = startDay; i < 30; curDate = curDate.minusDays(1)) {
int monthDay = endDay.getDayOfMonth() - startDay.getDayOfMonth() + 1;
for (DateTime curDate = startDay; i < monthDay; curDate = curDate.minusDays(1)) {
i++;
nowTime = curDate.getMillis();
lastTime = nowTime + 24 * 3600 * 1000 - 1;
......
......@@ -4,7 +4,6 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.BranchCompanyVehicleCountBiz;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCountVo;
......@@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Controller
@RequestMapping(value = "/bg-vehicle/count")
......@@ -33,8 +33,8 @@ public class BranchCompanyVehicleCountController extends BaseController<BranchCo
}
@GetMapping("/app/unauth/export")
public void exportVehicleInfo(BranchCompanyVehicleCountDTO branchCompanyVehicleCountDTO) throws Exception {
PageDataVO<BranchCompanyVehicleCountVo> pageDataVO = baseBiz.getAllCountInfo(branchCompanyVehicleCountDTO).getData();
if (pageDataVO != null && pageDataVO.getData() != null) {
List<BranchCompanyVehicleCountVo> pageDataVO = baseBiz.exportAllDate(branchCompanyVehicleCountDTO);
if (pageDataVO != null && pageDataVO.size() > 0) {
ExcelWriter writer = ExcelUtil.getWriter(true);
writer.addHeaderAlias("companyId", "公司ID");
writer.addHeaderAlias("companyName", "公司名");
......@@ -50,7 +50,7 @@ public class BranchCompanyVehicleCountController extends BaseController<BranchCo
writer.setColumnWidth(6, 17);
writer.setColumnWidth(1, 17);
// 一次性写出内容,使用默认样式,强制输出标题
writer.write(pageDataVO.getData(), true);
writer.write(pageDataVO, true);
//response为HttpServletResponse对象
response.setContentType("application/vnd.ms-excel;charset=utf-8");
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
......
......@@ -606,6 +606,7 @@
FROM
vehicle v
LEFT JOIN branch_company b ON b.id = v.park_branch_company_id
where v.is_del = 0
GROUP BY
b.id
</select>
......
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