Commit 8d9ff4a9 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev' into dev

parents a909e51b 57aa1978
...@@ -11,6 +11,7 @@ import com.xxfc.platform.im.entity.CustomerService; ...@@ -11,6 +11,7 @@ import com.xxfc.platform.im.entity.CustomerService;
import com.xxfc.platform.im.mapper.CustomerServiceMapper; import com.xxfc.platform.im.mapper.CustomerServiceMapper;
import com.xxfc.platform.im.vo.CustomerServiceVO; import com.xxfc.platform.im.vo.CustomerServiceVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -54,14 +55,14 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -54,14 +55,14 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
CustomerService customerService = new CustomerService(); CustomerService customerService = new CustomerService();
BeanUtils.copyProperties(customerServiceDTO, customerService); BeanUtils.copyProperties(customerServiceDTO, customerService);
if (Objects.isNull(customerServiceDTO.getId())){ if (Objects.isNull(customerServiceDTO.getId())) {
customerService.setCreateTime(Instant.now().toEpochMilli()); customerService.setCreateTime(Instant.now().toEpochMilli());
customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone())); customerService.setName(String.format("%s%s", NICK_PRE_NAME, customerServiceDTO.getTelphone()));
customerService.setIsDel(false); customerService.setIsDel(false);
customerService.setPassword(INIT_PASSWORD); customerService.setPassword(StringUtils.isEmpty(customerServiceDTO.getPassword()) ? INIT_PASSWORD : customerServiceDTO.getPassword().trim().length() > 0 ? customerServiceDTO.getPassword() : INIT_PASSWORD);
Map<String, Object> imMap = new HashMap<>(2); Map<String, Object> imMap = new HashMap<>(2);
imMap.put("telephone", customerServiceDTO.getTelphone()); imMap.put("telephone", customerServiceDTO.getTelphone());
imMap.put("password", INIT_PASSWORD); imMap.put("password", DigestUtils.md5Hex(customerService.getPassword()));
imMap.put("nickname", customerService.getName()); imMap.put("nickname", customerService.getName());
BaseResponse imResponse = userBiz.register(imMap); BaseResponse imResponse = userBiz.register(imMap);
String imResult = imResponse.getMessage(); String imResult = imResponse.getMessage();
...@@ -73,10 +74,10 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -73,10 +74,10 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
} }
customerService.setImUserId((Integer) userId); customerService.setImUserId((Integer) userId);
mapper.insertSelective(customerService); mapper.insertSelective(customerService);
}else { } else {
customerService.setUpdateTime(Instant.now().toEpochMilli()); customerService.setUpdateTime(Instant.now().toEpochMilli());
if (!StringUtils.isEmpty(customerServiceDTO.getPassword())){ if (!StringUtils.isEmpty(customerServiceDTO.getPassword())) {
userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(),customerServiceDTO.getPassword()); userBiz.updatePasswordByPhone(customerServiceDTO.getTelphone(), customerServiceDTO.getPassword());
} }
mapper.updateByPrimaryKeySelective(customerService); mapper.updateByPrimaryKeySelective(customerService);
} }
...@@ -121,12 +122,12 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -121,12 +122,12 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
public void updatePasswordByPhone(String telphone, String password) { public void updatePasswordByPhone(String telphone, String password) {
Example example = new Example(CustomerService.class); Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("telphone",telphone); criteria.andEqualTo("telphone", telphone);
CustomerService customerService = new CustomerService(); CustomerService customerService = new CustomerService();
customerService.setPassword(password); customerService.setPassword(DigestUtils.md5Hex(password));
customerService.setUpdateTime(Instant.now().toEpochMilli()); customerService.setUpdateTime(Instant.now().toEpochMilli());
mapper.updateByExampleSelective(customerService,example); mapper.updateByExampleSelective(customerService, example);
} }
public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) { public PageDataVO<CustomerServiceVO> findCustomerServiceWithPage(Integer page, Integer limit) {
...@@ -134,11 +135,11 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -134,11 +135,11 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
Example example = new Example(CustomerService.class); Example example = new Example(CustomerService.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",false); criteria.andEqualTo("isDel", false);
PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page,limit,()->mapper.selectByExample(example)); PageDataVO<CustomerService> pageDataVO = PageDataVO.pageInfo(page, limit, () -> mapper.selectByExample(example));
List<CustomerService> data = pageDataVO.getData(); List<CustomerService> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)){ if (CollectionUtils.isEmpty(data)) {
return dataVO; return dataVO;
} }
...@@ -146,7 +147,7 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -146,7 +147,7 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
CustomerServiceVO customerServiceVO; CustomerServiceVO customerServiceVO;
for (CustomerService customerService : data) { for (CustomerService customerService : data) {
customerServiceVO = new CustomerServiceVO(); customerServiceVO = new CustomerServiceVO();
BeanUtils.copyProperties(customerService,customerServiceVO); BeanUtils.copyProperties(customerService, customerServiceVO);
customerServiceVOS.add(customerServiceVO); customerServiceVOS.add(customerServiceVO);
} }
...@@ -161,7 +162,7 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS ...@@ -161,7 +162,7 @@ public class CustomerServiceBiz extends BaseBiz<CustomerServiceMapper, CustomerS
public CustomerServiceDTO findCustomerServiceById(Long id) { public CustomerServiceDTO findCustomerServiceById(Long id) {
CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO(); CustomerServiceDTO customerServiceDTO = new CustomerServiceDTO();
CustomerService customerService = mapper.selectByPrimaryKey(id); CustomerService customerService = mapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(customerService,customerServiceDTO); BeanUtils.copyProperties(customerService, customerServiceDTO);
return customerServiceDTO; return customerServiceDTO;
} }
} }
...@@ -7,9 +7,9 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -7,9 +7,9 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum; import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum; import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.DailyTravelOrderStatistics; import com.xxfc.platform.order.entity.DailyTravelOrderStatistics;
import com.xxfc.platform.order.entity.OrderAccount; import com.xxfc.platform.order.entity.OrderAccount;
import com.xxfc.platform.order.entity.OrderStatistics; import com.xxfc.platform.order.entity.OrderStatistics;
...@@ -197,7 +197,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -197,7 +197,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyTravelOrderStatistics orderStatistics) { private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyTravelOrderStatistics orderStatistics) {
ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList(); ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList();
for (Integer key : map.keySet()) { for (Integer key : map.keySet()) {
if (!key.equals(RefundTypeEnum.ORDER_FUND.getCode())) { if (!key.equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) {
arrayList.addAll(map.get(key)); arrayList.addAll(map.get(key));
} }
} }
...@@ -222,7 +222,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -222,7 +222,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
private DailyTravelOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) { private DailyTravelOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) {
DailyTravelOrderStatistics orderStatistics = new DailyTravelOrderStatistics(); DailyTravelOrderStatistics orderStatistics = new DailyTravelOrderStatistics();
List<OrderAccountDTO> orderAccountDTOS = map.get(RefundTypeEnum.ORDER_FUND.getCode()); List<OrderAccountDTO> orderAccountDTOS = map.get(AccountTypeEnum.IN_ORDER_PAY.getCode());
if (CollectionUtils.isNotEmpty(orderAccountDTOS)) { if (CollectionUtils.isNotEmpty(orderAccountDTOS)) {
ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS); ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS);
...@@ -276,9 +276,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -276,9 +276,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
*/ */
private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) { private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) {
ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList(); ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList();
for (OrderAccountDetail orderAccountDetail : orderAccountDetails) { orderAccountDetails.parallelStream().map(OrderAccountDetail::getDeductions).forEach(e->arrayList.addAll(e));
arrayList.addAll(orderAccountDetail.getDeductions());
}
return arrayList; return arrayList;
} }
...@@ -286,14 +284,14 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati ...@@ -286,14 +284,14 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
/** /**
* 根据type获取对应的金额总和 * 根据type获取对应的金额总和
* *
* @param OrderAccountDeduction * @param list
* @param type 金额类型 * @param type 金额类型
* @return * @return
*/ */
private BigDecimal get(List<OrderAccountDeduction> OrderAccountDeduction, List<Integer> type) { private BigDecimal get(List<OrderAccountDeduction> list, List<Integer> type) {
return OrderAccountDeduction.parallelStream() return list.parallelStream()
.filter(el -> el.getType().equals(type)) .filter(el ->type.contains(el.getType()))
.map(com.xxfc.platform.order.pojo.account.OrderAccountDeduction::getAmount) .map(OrderAccountDeduction::getAmount)
.reduce(BigDecimal.ZERO,BigDecimal::add); .reduce(BigDecimal.ZERO,BigDecimal::add);
} }
......
...@@ -4,9 +4,9 @@ import cn.hutool.json.JSONUtil; ...@@ -4,9 +4,9 @@ import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum; import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum; import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.DailyVehicleOrderStatistics; import com.xxfc.platform.order.entity.DailyVehicleOrderStatistics;
import com.xxfc.platform.order.entity.OrderAccount; import com.xxfc.platform.order.entity.OrderAccount;
import com.xxfc.platform.order.entity.OrderStatistics; import com.xxfc.platform.order.entity.OrderStatistics;
...@@ -208,14 +208,14 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -208,14 +208,14 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
/** /**
* 根据type获取对应的金额总和 * 根据type获取对应的金额总和
* *
* @param OrderAccountDeduction * @param list
* @param types 金额类型 * @param types 金额类型
* @return * @return
*/ */
private BigDecimal get(List<OrderAccountDeduction> OrderAccountDeduction, List<Integer> types) { private BigDecimal get(List<OrderAccountDeduction> list, List<Integer> types) {
return OrderAccountDeduction.parallelStream() return list.parallelStream()
.filter(el -> types.contains(el)) .filter(el -> types.contains(el.getType()))
.map(com.xxfc.platform.order.pojo.account.OrderAccountDeduction::getAmount) .map(OrderAccountDeduction::getAmount)
.reduce(BigDecimal.ZERO,BigDecimal::add); .reduce(BigDecimal.ZERO,BigDecimal::add);
} }
...@@ -342,7 +342,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -342,7 +342,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyVehicleOrderStatistics orderStatistics) { private void refundAndDeductions(Map<Integer, List<OrderAccountDTO>> map, DailyVehicleOrderStatistics orderStatistics) {
ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList(); ArrayList<OrderAccountDTO> arrayList = Lists.newArrayList();
for (Integer key : map.keySet()) { for (Integer key : map.keySet()) {
if (!key.equals(RefundTypeEnum.ORDER_FUND.getCode())) { if (!key.equals(AccountTypeEnum.IN_ORDER_PAY.getCode())) {
arrayList.addAll(map.get(key)); arrayList.addAll(map.get(key));
} }
} }
...@@ -387,7 +387,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -387,7 +387,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
*/ */
private DailyVehicleOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) { private DailyVehicleOrderStatistics getGmvAndSecurityDeposit(Map<Integer, List<OrderAccountDTO>> map) {
DailyVehicleOrderStatistics orderStatistics = new DailyVehicleOrderStatistics(); DailyVehicleOrderStatistics orderStatistics = new DailyVehicleOrderStatistics();
List<OrderAccountDTO> orderAccountDTOS = map.get(RefundTypeEnum.ORDER_FUND.getCode()); List<OrderAccountDTO> orderAccountDTOS = map.get(AccountTypeEnum.IN_ORDER_PAY.getCode());
if (CollectionUtils.isNotEmpty(orderAccountDTOS)) { if (CollectionUtils.isNotEmpty(orderAccountDTOS)) {
ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS); ArrayList<OrderAccountDetail> orderAccountDetails = getOrderAccountDetail(orderAccountDTOS);
...@@ -437,9 +437,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta ...@@ -437,9 +437,7 @@ public class DailyVehicleOrderStatisticsBiz extends BaseBiz<DailyVehicleOrderSta
*/ */
private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) { private List<OrderAccountDeduction> gettDeductions(ArrayList<OrderAccountDetail> orderAccountDetails) {
ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList(); ArrayList<OrderAccountDeduction> arrayList = Lists.newArrayList();
for (OrderAccountDetail orderAccountDetail : orderAccountDetails) { orderAccountDetails.parallelStream().map(OrderAccountDetail::getDeductions).forEach(e->arrayList.addAll(e));
arrayList.addAll(orderAccountDetail.getDeductions());
}
return arrayList; return arrayList;
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
resultMap="order"> resultMap="order">
SELECT SELECT
<if test="type==2"> <if test="type==2">
DATE_FORMAT(date( FROM_UNIXTIME( a.account_time / 1000 ) ),'%Y-%v') AS period, DATE_FORMAT(date( FROM_UNIXTIME( a.account_time / 1000 ) ),'%x-%v') AS period,
</if> </if>
<if test="type==3"> <if test="type==3">
DATE_FORMAT(date( FROM_UNIXTIME( a.account_time / 1000 ) ),'%Y-%m') AS period, DATE_FORMAT(date( FROM_UNIXTIME( a.account_time / 1000 ) ),'%Y-%m') AS period,
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</if> </if>
GROUP BY GROUP BY
<if test="type==2"> <if test="type==2">
DATE_FORMAT(date( FROM_UNIXTIME( a.account_time / 1000 ) ),'%Y-%v'), DATE_FORMAT(date( FROM_UNIXTIME( a.account_time / 1000 ) ),'%x-%v'),
</if> </if>
<if test="type==3"> <if test="type==3">
DATE_FORMAT(date( FROM_UNIXTIME( a.account_time / 1000 ) ),'%Y-%m'), DATE_FORMAT(date( FROM_UNIXTIME( a.account_time / 1000 ) ),'%Y-%m'),
......
package com.xxfc.platform.vehicle.pojo;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleDepartureLog;
import lombok.Data;
@Data
public class DepartureLogVo extends VehicleDepartureLog {
VehicleBookRecord vehicleBookRecord;
}
...@@ -12,6 +12,7 @@ import com.xxfc.platform.vehicle.entity.Vehicle; ...@@ -12,6 +12,7 @@ import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleDepartureLog; import com.xxfc.platform.vehicle.entity.VehicleDepartureLog;
import com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper; import com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper;
import com.xxfc.platform.vehicle.mapper.VehicleMapper; import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.pojo.DepartureLogVo;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo; import com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureStatisticDataVo; import com.xxfc.platform.vehicle.pojo.VehicleDepartureStatisticDataVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -24,6 +25,7 @@ import tk.mybatis.mapper.weekend.WeekendSqls; ...@@ -24,6 +25,7 @@ import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
@Slf4j @Slf4j
...@@ -103,6 +105,9 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, ...@@ -103,6 +105,9 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
} }
public Integer selectAllDepartureLog(Map<String, Object> param) {
return mapper.selectAllDepartureLog(param);
}
public ObjectRestResponse findOne(Integer vid) throws Exception { public ObjectRestResponse findOne(Integer vid) throws Exception {
Example exm = Example.builder(VehicleDepartureLog.class) Example exm = Example.builder(VehicleDepartureLog.class)
......
...@@ -10,4 +10,5 @@ public interface VehicleCountRecordMapper extends Mapper<VehicleCountRecord> { ...@@ -10,4 +10,5 @@ public interface VehicleCountRecordMapper extends Mapper<VehicleCountRecord> {
List<VehicleCountRecord> countDepartureVehicle(VehicleCountRecord vehicleCountRecord); List<VehicleCountRecord> countDepartureVehicle(VehicleCountRecord vehicleCountRecord);
List<VehicleCountRecord> selectByTypeAndTime(Map<String, Object> param); List<VehicleCountRecord> selectByTypeAndTime(Map<String, Object> param);
List<VehicleCountRecord> selectByTime(Map<String, Object> param);
} }
\ No newline at end of file
package com.xxfc.platform.vehicle.mapper; package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehicleDepartureLog; import com.xxfc.platform.vehicle.entity.VehicleDepartureLog;
import com.xxfc.platform.vehicle.pojo.DepartureLogVo;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo; import com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.BaseMapper; import tk.mybatis.mapper.common.BaseMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
import java.util.Map;
public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLog>, Mapper<VehicleDepartureLog> { public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLog>, Mapper<VehicleDepartureLog> {
...@@ -32,4 +34,5 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo ...@@ -32,4 +34,5 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
String selectDayByVehicleId(String vehicleId); String selectDayByVehicleId(String vehicleId);
VehicleDepartureLogVo selectByBookRecordId(Long bookRecordId); VehicleDepartureLogVo selectByBookRecordId(Long bookRecordId);
Integer selectAllDepartureLog(Map<String, Object> param);
} }
...@@ -30,7 +30,7 @@ public class VehicleCountRecordController { ...@@ -30,7 +30,7 @@ public class VehicleCountRecordController {
@GetMapping("/app/unauth/get") @GetMapping("/app/unauth/get")
@ResponseBody @ResponseBody
public ObjectRestResponse getByTypeAndDate(VehicleCountRecord vehicleCountRecord) { public ObjectRestResponse getByTypeAndDate(VehicleCountRecord vehicleCountRecord) {
return vehicleCountRecordBiz.countDepartureVehicle(vehicleCountRecord); return vehicleCountRecordBiz.selectByTime(vehicleCountRecord);
} }
@PostMapping("/app/unauth/export") @PostMapping("/app/unauth/export")
...@@ -43,4 +43,10 @@ public class VehicleCountRecordController { ...@@ -43,4 +43,10 @@ public class VehicleCountRecordController {
public void download(ExcelParamDto excelParamDto, HttpServletRequest request,HttpServletResponse response) { public void download(ExcelParamDto excelParamDto, HttpServletRequest request,HttpServletResponse response) {
DownloadUtil.downloadFile(excelParamDto.getPath(), "export.xls", response,request); DownloadUtil.downloadFile(excelParamDto.getPath(), "export.xls", response,request);
} }
@GetMapping("/app/unauth/selectByTime")
public ObjectRestResponse selectByTime(VehicleCountRecord vehicleCountRecord) {
return vehicleCountRecordBiz.selectByTime(vehicleCountRecord);
}
} }
...@@ -35,4 +35,12 @@ ...@@ -35,4 +35,12 @@
order by id DESC order by id DESC
</select> </select>
<select id="selectByTime" parameterType = "Map" resultType="com.xxfc.platform.vehicle.entity.VehicleCountRecord">
select * from vehicle_count_record
where count_date &gt;= #{startTime} and count_date &lt;= #{endTime}
<if test="type != null">
and type = #{type}
</if>
order by id DESC
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper" > <mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper" >
<resultMap id="searchBookRecord" type="com.xxfc.platform.vehicle.pojo.DepartureLogVo">
<result column="book_record_id" property="bookRecordId" jdbcType="INTEGER" javaType="java.lang.Integer"/>
<association property="vehicleBookRecord" column="id"
select="com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.selectOne"/>
</resultMap>
<select id="selectLastByVehicleId" resultType="com.xxfc.platform.vehicle.entity.VehicleDepartureLog"> <select id="selectLastByVehicleId" resultType="com.xxfc.platform.vehicle.entity.VehicleDepartureLog">
select * from vehicle_departure_log select * from vehicle_departure_log
where vehicle_id = #{vehicleId} where vehicle_id = #{vehicleId}
...@@ -30,7 +34,55 @@ ...@@ -30,7 +34,55 @@
where vehicle_departure_log.book_record_id = #{id} where vehicle_departure_log.book_record_id = #{id}
order by create_time desc order by create_time desc
</select> </select>
<select id="selectAllDepartureLog" resultType="java.lang.Integer" parameterType="Map">
SELECT
count(*)
FROM
vehicle_departure_log v1
LEFT JOIN vehicle_book_record v2 on v1.book_record_id = v2.id
<where>
<if test="startTime != null and status == 1">
and (v1.departure_time between #{startTime} and #{endTime})
</if>
<if test="startTime != null and status == 2">
and (v1.arrival_time between #{startTime} and #{endTime})
</if>
<!--正常出车-->
<if test="startTime != null and status == 1 and type == 1">
and (v2.book_start_date between #{startTime} and #{endTime})
</if>
<!--提前出车-->
<if test="endTime != null and status == 1 and type == 2">
and v2.book_start_date &gt;= #{endTime}
</if>
<!--延期出车-->
<if test="startTime != null and status == 1 and type == 3">
and v2.book_start_date &lt;= #{startTime}
</if>
<!--正常还车-->
<if test="startTime != null and status == 2 and type == 1">
and (v2.book_start_date between #{startTime} and #{endTime})
</if>
<!--提前还车-->
<if test="endTime != null and status == 2 and type == 2">
and v2.book_start_date &gt;= #{endTime}
</if>
<!--延期还车-->
<if test="startTime != null and status == 2 and type == 3">
and v2.book_start_date &lt;= #{startTime}
</if>
<!--统计客户用车-->
<if test="bookUser != null">
and v2.book_user = #{bookUser}
</if>
<if test="bookUser == null">
and v2.book_user != -2
</if>
</where>
</select>
<select id="selectVoAll" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo"> <select id="selectVoAll" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo">
select vehicle_departure_log.*,vehicle.number_plate, select vehicle_departure_log.*,vehicle.number_plate,
/* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/ /* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
......
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