Commit fb7844a3 authored by libin's avatar libin

Merge branch 'master' into wallet_detail

parents 44495cba 7e60347b
package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
......@@ -15,13 +14,11 @@ import com.xxfc.platform.order.biz.OrderRentVehicleBiz;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO;
import com.xxfc.platform.order.pojo.order.RentVehicleBO;
import com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO;
import com.xxfc.platform.order.pojo.order.add.BgAddRentDTO;
import com.xxfc.platform.order.pojo.price.RentVehiclePriceVO;
import com.xxfc.platform.order.service.OrderRentVehicleService;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
......@@ -37,14 +34,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
@Controller
@RequestMapping("orderRentVehicle")
@Api(value="租车订单",tags={"租车订单"})
......@@ -81,6 +74,7 @@ public class OrderRentVehicleController extends CommonBaseController {
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData());
orderRentVehicleService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder());
// return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "系统维护,请联系客服线下租车: 4000-369-369!");
}
@RequestMapping(value = "back-stage/add",method = RequestMethod.POST)
......
......@@ -323,7 +323,7 @@
(
(
orv.start_time > #{startTime}
AND orv.start_time < #{startTime}
AND orv.start_time < #{endTime}
AND orv.end_time > #{endTime}
)
OR (
......@@ -332,7 +332,7 @@
)
OR (
orv.start_time < #{startTime}
AND orv.end_time > #{endTime}
AND orv.end_time > #{startTime}
AND orv.end_time < #{endTime}
)
OR (
......
......@@ -20,7 +20,10 @@ 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.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
......@@ -95,8 +98,8 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
branchCompanyVehicleCountDTO.setPage(page);
branchCompanyVehicleCountDTO.setLimit(limit);
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));
branchCompanyVehicleCountDTO.setStartTime(DateTime.now().toString(DATE_TIME_FORMATTER));
branchCompanyVehicleCountDTO.setEndTime(DateTime.now().toString(DATE_TIME_FORMATTER));
}
Query query = new Query(branchCompanyVehicleCountDTO);
if (type == 1) {//按天
......@@ -120,4 +123,32 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
return ObjectRestResponse.succ(new PageDataVO<>());
}
public List<BranchCompanyVehicleCountVo> exportAllDate(BranchCompanyVehicleCountDTO branchCompanyVehicleCountDTO) {
Integer type = branchCompanyVehicleCountDTO.getType() == null ? 1 : branchCompanyVehicleCountDTO.getType();
Map<String, Object> param = new HashMap<>();
if (branchCompanyVehicleCountDTO.getCompanyId() != null) {
param.put("companyId", branchCompanyVehicleCountDTO.getCompanyId());
}
if (type == 1) {//按天
return mapper.getAllCountInfo(param);
}
if (type == 2) {//按周
List<BranchCompanyVehicleCountVo> pageDataVO = mapper.countByWeek(param);
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(param);
}
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;
......
......@@ -103,6 +103,9 @@ public class VehicleWarningMsgBiz extends BaseBiz<VehicleWarningMsgMapper, Vehic
*/
public RestResponse<PageDataVO<VehicleWarningMsg>> getByPage(String queryVehicleWarningMsgVoJson){
try {
if (StringUtils.isBlank(queryVehicleWarningMsgVoJson)) {
return RestResponse.codeAndMessage(ResCode.INVALID_REST_REQ_PARAM.getCode(), ResCode.INVALID_REST_REQ_PARAM.getDesc());
}
QueryVehicleWarningMsgVo queryVehicleWarningMsgVo = JSON.parseObject(queryVehicleWarningMsgVoJson, QueryVehicleWarningMsgVo.class);
PageHelper.startPage(queryVehicleWarningMsgVo.getPage(),queryVehicleWarningMsgVo.getLimit());
UserDTO userDTO = getAdminUserInfo();
......
......@@ -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是弹出下载对话框的文件名,不能为中文,中文请自行编码
......
......@@ -598,16 +598,17 @@
SELECT
b.id AS companyId,
DATE_FORMAT(
DATE_SUB(NOW(), INTERVAL 1 DAY),
NOW(),
'%Y'
) AS countYear,
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY), '%m') AS countMonth,
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY), '%u') AS countWeek,
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY), '%Y-%m-%d') AS countDate,
DATE_FORMAT(NOW(), '%m') AS countMonth,
DATE_FORMAT(NOW(), '%u') AS countWeek,
DATE_FORMAT(NOW(), '%Y-%m-%d') AS countDate,
count(*) AS vehicleNum
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