Commit 8b1e1391 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/master'

parents f05d9c4f 075c08ec
......@@ -5,6 +5,10 @@ import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 手动给集合分页
* @author Administrator
*/
@Data
public class PageResult<M> {
/** 页码 */
......
......@@ -163,6 +163,15 @@ public interface UserFeign {
@RequestParam(value = "cono",required = false) String cono,
@RequestParam(value = "reason",required = false) String reason,
@RequestParam(value = "isSuccess") Boolean isSuccess);
/**
* 通过公司id,获取员工的下级用户id
* @param parentCompanyId
* @return
*/
@GetMapping("/postion/admin/userid")
List<Integer> getUserIdByParentCompany(@RequestParam("parentCompanyId") List<Integer> parentCompanyId);
@GetMapping("/app/user/list_staff")
List<UserStaffBo> findAllStaffs();
......
......@@ -345,4 +345,7 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
}
public List<Integer> getUserIdByParentCompany(List<Integer> parentCompanyId) {
return mapper.getUserIdByParentCompany(parentCompanyId);
}
}
......@@ -3,8 +3,12 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 用户身份职位表
*
......@@ -17,4 +21,6 @@ public interface AppUserPositionTempMapper extends Mapper<AppUserPositionTemp> {
@Insert("INSERT IGNORE INTO `app_user_position_temp`(`user_id`,`phone`,`name`,`position_id`,`crt_time`)VALUES(#{userId},#{phone},#{name},#{positionId},#{crtTime})")
void insertWithIgnoreRepeat(AppUserPositionTemp appUserPositionTemp);
List<Integer> getUserIdByParentCompany(@Param("parentCompanyId") List<Integer> parentCompanyId);
}
......@@ -107,4 +107,10 @@ public class AppUserPositionController {
return ObjectRestResponse.succ(dataVO);
}
@GetMapping("/userid")
public List<Integer> getUserIdByParentCompany(@RequestParam("parentCompanyId") List<Integer> parentCompanyId){
return appUserPositionTempBiz.getUserIdByParentCompany(parentCompanyId);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.github.wxiaoqi.security.admin.mapper.AppUserPositionTempMapper">
<select id="getUserIdByParentCompany" resultType="Integer">
SELECT
r.uid
FROM
app_user_position_temp pt
LEFT JOIN app_user_detail d ON pt.user_id = d.userid
LEFT JOIN (
SELECT
parent_id AS pid,
user_id AS uid
FROM
app_user_relation
WHERE
is_del = 0
) r ON d.userid = r.pid
WHERE
pt.is_del = 0
<if test="parentCompanyId != null and parentCompanyId.size() !=0">
AND pt.company_id IN
<foreach collection="parentCompanyId" index="index" item="pid" open="(" separator="," close=")">
#{pid}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
package com.xxfc.platform.order.contant.enumerate;
/**
* 账目类型
* @author Administrator
*/
public enum BookkeepingTypeEnum {
ENTER(0,"入账"),OUT(1,"出账");
private Integer code;
private String msg;
BookkeepingTypeEnum(int code, String msg) {
this.code=code;
this.msg=msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
package com.xxfc.platform.order.pojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Data
@ApiModel("订单业绩明细表")
public class Achievement implements Serializable {
private static final Map<Integer, String> orderTypeMap = new HashMap<>();
private static final Map<Integer, String> payWayMap = new HashMap<>();
static {
orderTypeMap.put(1, "租车");
orderTypeMap.put(2, "旅游");
orderTypeMap.put(3, "会员");
payWayMap.put(null, "微信");
payWayMap.put(1, "微信支付");
payWayMap.put(2, "支付宝支付");
payWayMap.put(3, "银联支付");
}
@ApiModelProperty(value = "下单用户真实姓名")
private String realname;
@ApiModelProperty(value = "用户手机号")
private String username;
@ApiModelProperty(value = "上级姓名")
private String parentRealname;
@ApiModelProperty(value = "上级职位")
private String positionName;
@ApiModelProperty(value = "上级手机号")
private String parentUsername;
@ApiModelProperty(value = "订单所属公司id")
private Integer companyId;
@ApiModelProperty(value = "订单所属公司名")
private String companyName;
@ApiModelProperty(value = "优惠价格")
private BigDecimal favorablePrice = BigDecimal.ZERO;
@ApiModelProperty(value = "创建时间", hidden = true)
@Column(name = "crt_time")
private String crtTime;
@ApiModelProperty(value = "订单号")
private String no;
@ApiModelProperty(value = "订单类型")
private Integer type;
@Column(name = "order_amount")
@ApiModelProperty("订单总额")
private BigDecimal orderAmount = BigDecimal.ZERO;
@ApiModelProperty(value = "实际订单额")
@Column(name = "real_amount")
private BigDecimal realAmount = BigDecimal.ZERO;
@Column(name = "pay_way")
@ApiModelProperty(value = "支付方式")
private Integer payWay;
public void setCrtTime(Date crtTime) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
this.crtTime = dateFormat.format(crtTime);
}
public String getType() {
return orderTypeMap.get(type);
}
public String getPayWay() {
return payWayMap.get(payWay);
}
}
package com.xxfc.platform.order.pojo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 总业绩查询条件
* @author Administrator
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
public class QueryCriteria {
@ApiModelProperty(value ="开始时间" )
private Date startDate;
@ApiModelProperty(value = "结束时间")
private Date endDate;
@ApiModelProperty(value = "订单类型:1-租车 2-旅游 3-会员 null-全部")
private Integer orderType;
@ApiModelProperty(value = "业绩所属公司")
private Integer companyId;
@ApiModelProperty(value = "支付方式: 1-微信支付 2-支付宝支付 3-银联支付 null-全部")
private Integer paymentMethod;
@ApiModelProperty(value = "账目类型: 0-入账 1-出账")
private Integer type = 0;
@ApiModelProperty("权限公司id")
private List<Integer> jurisdiction;
@ApiModelProperty(value = "当前页数")
private Integer page=1;
@ApiModelProperty(value = "每页条数")
private Integer limit=10;
}
package com.xxfc.platform.order.pojo;
import com.alibaba.fastjson.JSON;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;
import javax.persistence.Column;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Data
public class ReturnOrderAmount implements Serializable {
private static final long serialVersionUID = -8445943548965154778L;
private static final Map<Integer, String> orderTypeMap = new HashMap<>();
static {
orderTypeMap.put(1, "租车");
orderTypeMap.put(2, "旅游");
orderTypeMap.put(3, "会员");
}
@ApiModelProperty(value = "时间")
private Long time;
@ApiModelProperty(value = "订单号")
private String no;
@ApiModelProperty(value = "订单类型")
private Integer type;
@ApiModelProperty(value = "订单明细")
private String accountDetail;
@ApiModelProperty(value = "用户姓名")
private String realname;
@ApiModelProperty(value = "手机号")
private String username;
@ApiModelProperty(value = "退款说明")
private String refundInstruction;
@ApiModelProperty(value = "退款明细")
private BigDecimal refundAmount = BigDecimal.ZERO;
@ApiModelProperty("退还类型")
@Column(name = "account_type")
private Integer accountType;
public OrderAccountDetail getAccountDetail() {
return StringUtils.hasText(accountDetail) ? JSON.parseObject(accountDetail, OrderAccountDetail.class) : new OrderAccountDetail();
}
public String getType() {
return orderTypeMap.get(type);
}
public Integer getTypeInt() {
return this.type;
}
public String getTime() {
Date date = new Date(this.time);
return new SimpleDateFormat("yyyy-MM-dd").format(date);
}
}
package com.xxfc.platform.order.pojo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
/**
* 总业绩报表类
*
* @author Administrator
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TotalOrderRevenue {
@ApiModelProperty(value = "总订单数")
private Integer orderSum;
@ApiModelProperty(value = "应收总额")
private BigDecimal totalReceivables=BigDecimal.ZERO;
@ApiModelProperty(value = "优惠金额")
private BigDecimal discount=BigDecimal.ZERO;
@ApiModelProperty(value = "实收金额")
private BigDecimal actual=BigDecimal.ZERO;
@ApiModelProperty(value = "数据明细")
private PageInfo<Achievement> achievements;
}
......@@ -5,6 +5,8 @@ import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
......@@ -25,7 +27,9 @@ import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.BaseOrderMapper;
import com.xxfc.platform.order.pojo.Achievement;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.dto.MemberOrderBo;
......@@ -889,7 +893,6 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return userFeign;
}
/**
* 订单查询类
*/
......@@ -926,4 +929,18 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return mapper.selectAllRentVehicleOrder(paramMap);
}
public List<Achievement> entryStatisticalData(QueryCriteria queryCriteria) {
return mapper.selectTotalStatistical(queryCriteria);
}
public PageInfo<Achievement> getAchievementPageInfo(QueryCriteria queryCriteria) {
PageHelper.startPage(queryCriteria.getPage(),queryCriteria.getLimit());
List<Achievement> achievements = mapper.selectTotalStatistical(queryCriteria);
return PageInfo.of(achievements);
}
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
......@@ -17,6 +19,8 @@ import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.OrderAccountMapper;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.pojo.ReturnOrderAmount;
import com.xxfc.platform.order.pojo.Term;
import com.xxfc.platform.order.pojo.account.OrderAccountBo;
import com.xxfc.platform.order.pojo.account.OrderAccountDTO;
......@@ -671,4 +675,17 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
List<OrderAccountBo> orderAccountBos = mapper.selectByDateAndStatffIds(startDate,endDate,staffUserIds);
return CollectionUtils.isNotEmpty(orderAccountBos)?Collections.EMPTY_LIST:orderAccountBos;
}
public List<ReturnOrderAmount> outStatisticalData(QueryCriteria queryCriteria) {
Long startTime=null;
Long endTime= null;
if (queryCriteria.getStartDate()!=null) {
startTime=queryCriteria.getStartDate().getTime();
}
if (queryCriteria.getEndDate()!=null) {
endTime= queryCriteria.getEndDate().getTime();
}
return mapper.outStatisticalData(queryCriteria,startTime,endTime);
}
}
\ No newline at end of file
......@@ -101,7 +101,7 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
String filePath = ovUpload + realFileRelPath;
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return ObjectRestResponse.succ(filePath);
}
......
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.pojo.Achievement;
import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.pojo.bg.BgOrderListVo;
import com.xxfc.platform.order.pojo.dto.MemberOrderBo;
import com.xxfc.platform.order.pojo.dto.MemberOrderFindDTO;
......@@ -47,4 +49,6 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> {
@Param("endDate") Date endDate);
List<OrderDTO> selectBaeOrderByOrderIds(@Param("orderIds") List<Integer> orderIds);
List<Achievement> selectTotalStatistical(QueryCriteria queryCriteria);
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderAccount;
import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.pojo.ReturnOrderAmount;
import com.xxfc.platform.order.pojo.Term;
import com.xxfc.platform.order.pojo.account.OrderAccountBo;
import com.xxfc.platform.order.pojo.account.OrderAccountDTO;
......@@ -9,6 +11,7 @@ import tk.mybatis.mapper.common.Mapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
......@@ -29,4 +32,6 @@ public interface OrderAccountMapper extends Mapper<OrderAccount> {
List<OrderAccountBo> selectByDateAndStatffIds(@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("staffUserIds") List<Integer> staffUserIds);
List<ReturnOrderAmount> outStatisticalData(@Param("queryCriteria")QueryCriteria queryCriteria,@Param("startTime") Long startTime,@Param("endTime")Long endTime);
}
package com.xxfc.platform.order.rest.background;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.auth.PageResult;
import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.xxfc.platform.order.biz.TotalPerformanceBiz;
import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.contant.enumerate.BookkeepingTypeEnum;
import com.xxfc.platform.order.pojo.ReturnOrderAmount;
import com.xxfc.platform.order.pojo.TotalOrderRevenue;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;
/**
* 总业绩报表
*
* @author Administrator
*/
@RestController()
@RequestMapping("/report/form")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Api(tags = "总业绩统计")
@IgnoreClientToken
@IgnoreUserToken
public class TotalPerformanceStatementController extends CommonBaseController {
private final TotalPerformanceBiz totalPerformanceBiz;
private final HttpServletRequest request;
private final UserAuthConfig userAuthConfig;
private final UserFeign userFeign;
private final VehicleFeign vehicleFeign;
private final Integer HIGHEST_AUTHORITY = 1;
@PostMapping("/list")
public ObjectRestResponse statisticalData(@RequestBody QueryCriteria queryCriteria) throws Exception {
UserDTO userDTO = userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData();
//获取用户权限
List<Integer> Jurisdiction = null;
//是否有查询所有数据的权限
if (!HIGHEST_AUTHORITY.equals(userDTO.getDataAll())) {
List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone());
Jurisdiction = branchCompanies.parallelStream().map(BranchCompany::getId).collect(Collectors.toList());
}
queryCriteria.setJurisdiction(Jurisdiction);
if (BookkeepingTypeEnum.ENTER.getCode().equals(queryCriteria.getType())) {
TotalOrderRevenue totalOrderRevenue = totalPerformanceBiz.entryStatisticalData(queryCriteria);
return ObjectRestResponse.succ(totalOrderRevenue);
}else if (BookkeepingTypeEnum.OUT.getCode().equals(queryCriteria.getType())){
List<ReturnOrderAmount> returnOrderAmounts = totalPerformanceBiz.outStatisticalData(queryCriteria);
return ObjectRestResponse.succ(PageResult.nowPageResult(queryCriteria.getPage(),queryCriteria.getLimit(),returnOrderAmounts));
}
return ObjectRestResponse.succ();
}
@PostMapping("/excel")
public void exportTotalPerformance(@RequestBody QueryCriteria queryCriteria, HttpServletResponse response) throws Exception {
try {
String name = DateTimeFormatter.ofPattern("YYYYMMddHHmmss").format(LocalDateTime.now());
response.setContentType("application/vnd.ms-excel;charset=utf-8");
String filename = String.format("%s.xlsx",name);
response.setHeader("Content-Disposition","attachment;filename="+filename);
ServletOutputStream outputStream = response.getOutputStream();
if (BookkeepingTypeEnum.ENTER.getCode().equals(queryCriteria.getType())) {
totalPerformanceBiz.exportEntry(queryCriteria, name, outputStream);
}else if (BookkeepingTypeEnum.OUT.getCode().equals(queryCriteria.getType())){
totalPerformanceBiz.exportAccount(queryCriteria, name, outputStream);
}else {
throw new BaseException("无相关数据");
}
response.setCharacterEncoding("UTF-8");
} catch (IOException e) {
throw new BaseException("导入数据失败");
}
}
}
......@@ -439,4 +439,37 @@
#{orderId}
</foreach>
</select>
<select id="selectTotalStatistical" parameterType="com.xxfc.platform.order.pojo.QueryCriteria"
resultType="com.xxfc.platform.order.pojo.Achievement">
select
crt_time,no,type,order_amount,real_amount,realname,username,parentRealname,positionName,parentUsername,companyName,pay_way,company_id,(order_amount-real_amount) as favorablePrice
from order_user_position_company
<where>
<if test="startDate != null">
and crt_time <![CDATA[>=]]> #{startDate}
</if>
<if test="endDate != null">
and crt_time <![CDATA[<=]]> #{endDate}
</if>
<if test="paymentMethod !=null">
and pay_way = #{paymentMethod}
</if>
<if test="jurisdiction != null and jurisdiction.size() !=0 ">
and company_id in
<foreach collection="jurisdiction" index="index" item="companyId" open="(" separator="," close=")">
#{companyId}
</foreach>
</if>
<if test="companyId != null ">
and company_id =#{companyId}
</if>
<if test="orderType != null">
and type = #{orderType}
</if>
</where>
order by crt_time DESC
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.order.mapper.OrderAccountMapper">
<select id="getOrderAccountByOrderType" parameterType="com.xxfc.platform.order.pojo.Term" resultType="com.xxfc.platform.order.pojo.account.OrderAccountDTO">
<select id="getOrderAccountByOrderType" parameterType="com.xxfc.platform.order.pojo.Term"
resultType="com.xxfc.platform.order.pojo.account.OrderAccountDTO">
SELECT
<if test="subdivide !=null and subdivide ==1">
date( FROM_UNIXTIME( a.crt_time / 1000 ) ) as oneDay,
......@@ -27,7 +28,7 @@
AND
b.type = #{orderType}
<if test="startTime != null">
AND a.crt_time <![CDATA[>= ]]> #{startTime}
AND a.crt_time <![CDATA[>= ]]> #{startTime}
</if>
<if test="endTime != null">
AND a.crt_time &gt; endTime
......@@ -49,7 +50,28 @@
<if test="subdivide !=null and subdivide ==1">
AND date( FROM_UNIXTIME( a.crt_time / 1000 ) ) = date( DATE_SUB( now( ), INTERVAL #{day} DAY ) )
</if>
</select>
<select id="outStatisticalData" resultType="com.xxfc.platform.order.pojo.ReturnOrderAmount">
select oa.crt_time as time ,oupc.no,oupc.type,oa.account_detail as accountDetail ,oupc.realname,oupc.username,oa.account_type
from order_account oa
left join order_user_position_company oupc ON oa.order_id=oupc.id
WHERE oa.account_type!=101
<if test="startTime != null">
and oa.crt_time <![CDATA[>=]]> #{startTime}
</if>
<if test="endTime != null">
and oa.crt_time <![CDATA[<=]]> #{endTime}
</if>
<if test="queryCriteria.jurisdiction != null and queryCriteria.jurisdiction.size() !=0 ">
and oupc.company_id in
<foreach collection="queryCriteria.jurisdiction" index="index" item="companyId" open="(" separator="," close=")">
#{companyId}
</foreach>
</if>
<if test="queryCriteria.orderType != null">
and oupc.type = #{queryCriteria.orderType}
</if>
order by oa.crt_time DESC
</select>
<select id="selectOrderAccountByOrderTypeAndStartTimeAndEndTime"
......
......@@ -72,8 +72,8 @@ public class ServiceTest {
@Test
public void test4(){
// HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null);
// System.out.println(totalOrder);
HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null,null);
System.out.println(totalOrder);
}
......
......@@ -5,7 +5,17 @@ public class DictionaryKey {
/**
* 订单类型
*/
public static final String APP_ORDER ="APP_ORDER";
public static final String APP_ORDER = "APP_ORDER";
/**
* 租车用途类型
*/
public static final String VEHICE_ORDER = "VEHICE_ORDER";
/**
* 租车用途类型CODE
*/
public static final String RESERVE = "RESERVE";
/**
......@@ -21,36 +31,36 @@ public class DictionaryKey {
/**
* IM类型
*/
public static final String IM_TYPE ="IM_TYPE";
public static final String IM_TYPE = "IM_TYPE";
/**
* IM限制条数
*/
public static final String MSG_LIMIT_NUMBER ="MSG_LIMIT_NUMBER";
public static final String MSG_LIMIT_NUMBER = "MSG_LIMIT_NUMBER";
/**
* 支付
*/
public static final String UNIVERSAL_PAY ="UNIVERSAL_PAY";
public static final String UNIVERSAL_PAY = "UNIVERSAL_PAY";
/**
* 租车,旅游(省内、省外)退款
* 租车,旅游(省内、省外)退款
*/
public static final String RENT_REFUND ="RENT_REFUND";
public static final String TOUR_REFUND ="TOUR_REFUND";
public static final String TOUR_IN_REFUND ="TOUR_IN_REFUND";
public static final String RENT_REFUND = "RENT_REFUND";
public static final String TOUR_REFUND = "TOUR_REFUND";
public static final String TOUR_IN_REFUND = "TOUR_IN_REFUND";
/**
* 租车:公司司机租金、免赔费用、违章预备金
*/
public static final String DRIVER_PRICE ="DRIVER_PRICE";
public static final String DAMAGE_SAFE ="DAMAGE_SAFE";
public static final String DRIVER_PRICE = "DRIVER_PRICE";
public static final String DAMAGE_SAFE = "DAMAGE_SAFE";
public static final String ILLEGAL_RESERVE = "ILLEGAL_RESERVE";
public static final String RENT_TIME_BUFFER = "RENT_TIME_BUFFER";
/**
* 旅游:保险费用
*/
public static final String INSURE_PRICE ="INSURE_PRICE";
public static final String INSURE_PRICE = "INSURE_PRICE";
/**
* 自动取消订单时间:租车、旅游
......
......@@ -69,7 +69,11 @@ public interface ThirdFeign {
@RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET)
public ObjectRestResponse<Map<String, Dictionary>> dictionaryGetAll4Map();
@PostMapping("/dictionary/type_code")
/* @RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET)
public ObjectRestResponse<Map<String, Dictionary>> getDictionaryUseType();*/
@PostMapping("/dictionary/type_code")
public Dictionary findDictionaryByTypeAndCode(@RequestParam(value = "type") String type,@RequestParam(value = "code") String code);
@GetMapping(value = "/certif/app/unauth/selectByUser")
......
......@@ -25,17 +25,17 @@ import static com.xxfc.platform.universal.constant.RedisKey.*;
public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
public ObjectRestResponse add(Dictionary dictionary) {
if(dictionary == null)
if (dictionary == null)
return ObjectRestResponse.paramIsEmpty();
List<Dictionary> dictionaryVos = mapper.selectByCodeAndType(dictionary);
if(dictionaryVos.size() == 1) {//已有数据 直接更新
if (dictionaryVos.size() == 1) {//已有数据 直接更新
BeanUtil.copyProperties(dictionary, dictionaryVos.get(0), CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
mapper.updateByPrimaryKeySelective(dictionaryVos.get(0));
return ObjectRestResponse.succ();
}
if(dictionary.getPid() != null) {//有父类 判断是否存在
if (dictionary.getPid() != null) {//有父类 判断是否存在
Dictionary parent = mapper.selectByPrimaryKey(dictionary.getPid());
if(parent == null) {
if (parent == null) {
log.info("pid所属数据不存在, dictionary = {}", dictionary);
return ObjectRestResponse.createFailedResult(500, "pid所属数据不存在");
}
......@@ -47,11 +47,11 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
}
public ObjectRestResponse<List<Dictionary>> get(Dictionary dictionary) {
if(dictionary == null) {
if (dictionary == null) {
return ObjectRestResponse.paramIsEmpty();
}
List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary);
for(Dictionary parent : dictionaryList) {
for (Dictionary parent : dictionaryList) {
Set<Dictionary> dictionaryVoList = buildTree(parent.getId());
parent.setChildrens(dictionaryVoList);
}
......@@ -60,20 +60,20 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
}
public ObjectRestResponse deleteByEntity(Dictionary dictionary) {
if(dictionary == null) {
if (dictionary == null) {
return ObjectRestResponse.paramIsEmpty();
}
//删除所有子元素
Set<Dictionary> childrens = mapper.selectByPid(dictionary.getId());
if(childrens.size() > 0) {
childrens.forEach((a) -> mapper.deleteByPrimaryKey(a));
}
if (childrens.size() > 0) {
childrens.forEach((a) -> mapper.deleteByPrimaryKey(a));
}
mapper.deleteByPrimaryKey(dictionary);
return ObjectRestResponse.succ();
}
public ObjectRestResponse update(Dictionary dictionary) {
if(StringUtils.isEmpty(dictionary)) {
if (StringUtils.isEmpty(dictionary)) {
return ObjectRestResponse.paramIsEmpty();
}
Dictionary oldValue = mapper.selectByPrimaryKey(dictionary.getId());
......@@ -83,7 +83,7 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
}
public ObjectRestResponse<List<Dictionary>> getParent(String type) {
if(StringUtils.isEmpty(type)) {
if (StringUtils.isEmpty(type)) {
return ObjectRestResponse.paramIsEmpty();
}
List<Dictionary> dictionaryList = getParentCommon(type);
......@@ -95,7 +95,7 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
dictionary.setType(type);
dictionary.setPid(0);
List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary);
for(Dictionary parent : dictionaryList) {
for (Dictionary parent : dictionaryList) {
Set<Dictionary> dictionaryVoList = buildTree(parent.getId());
parent.setChildrens(dictionaryVoList);
}
......@@ -103,36 +103,44 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
}
@Cache(key = CACHE_DICTIONARY_ALL_MAP)
public Map<String, Dictionary> getAll4Map(){
public Map<String, Dictionary> getAll4Map() {
// List<Dictionary> dictionaries = this.getParentCommon(null);
List<Dictionary> dictionaries = selectListAll();
Map<String, Dictionary> dictionaryMap = dictionaries.parallelStream().collect(Collectors.toMap(dic -> dic.getType()+ "_"+ dic.getCode()
Map<String, Dictionary> dictionaryMap = dictionaries.parallelStream().collect(Collectors.toMap(dic -> dic.getType() + "_" + dic.getCode()
, Function.identity(), (oldValue, newValue) -> newValue));
dictionaryMap.forEach((k,v) -> {
dictionaryMap.forEach((k, v) -> {
v.setChildrens(buildTree(v.getId()));
});
return dictionaryMap;
}
/* public Map<String, Dictionary> getDictionaryUseType() {
List<Dictionary> dictionaries = selectListAll();
Map<String, Dictionary> dictionaryMap = dictionaries.parallelStream().collect(Collectors.toMap(dic -> dic.getType() + "_" + dic.getCode()
, Function.identity(), (oldValue, newValue) -> newValue));
return dictionaryMap;
}*/
@CacheClear(pre = CACHE_DICTIONARY_PREFIX)
public void clear(){
public void clear() {
;
}
public DictionaryVo buidTree(Dictionary dictionary) {
DictionaryVo dictionaryVo = new DictionaryVo();
if(dictionary.getPid() == 0) {
if (dictionary.getPid() == 0) {
BeanUtil.copyProperties(dictionary, dictionaryVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
Set<Dictionary> childrens = mapper.selectByPid(dictionary.getId());
dictionaryVo.setChildrens(childrens);
for(Dictionary children : childrens) {
for (Dictionary children : childrens) {
buidTree(children);
}
}
return dictionaryVo;
}
public Set<Dictionary> buildTree(int parentId) {
public Set<Dictionary> buildTree(int parentId) {
Set<Dictionary> childrens = mapper.selectByPid(parentId);
Set<Dictionary> dictionaryVoList = new HashSet<>();
for (Dictionary dictionary : childrens) {
......@@ -150,8 +158,8 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
public Dictionary findDictionaryByTypeAndCode(String type, String code) {
Dictionary dictionary = new Dictionary();
dictionary.setType(type);
dictionary.setCode(code);
return mapper.selectOne(dictionary);
dictionary.setType(type);
dictionary.setCode(code);
return mapper.selectOne(dictionary);
}
}
......@@ -124,7 +124,7 @@ public class CertificationService {
exa.createCriteria().andEqualTo("idNumber", number);
List<IdInformation> idInformatics = idInformationMapper.selectByExample(exa);
if (CollectionUtils.isNotEmpty(idInformatics) && idInformatics.size() >getCofig() ) {
if (CollectionUtils.isNotEmpty(idInformatics) && idInformatics.size() >=getCofig() ) {
log.error("该身份证已超过最大认证次数");
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "该身份证已超过最大认证次数");
}
......
......@@ -56,7 +56,7 @@ public class UploadService {
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
realFileRelPath=xx_url+SystemConfig.XXMP_URL+realFileRelPath;
return realFileRelPath;
}
......@@ -166,7 +166,7 @@ public class UploadService {
//文件存放路径
String filePath = videoUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
realFileRelPath=xx_url+SystemConfig.VIDEO_URL+realFileRelPath;
return realFileRelPath;
}
......
......@@ -91,7 +91,7 @@ public class UploadZipServiceImpl implements UploadZipService {
if (PHOTO_FORMAT.contains(format)) {
String realFileRelPath = dirPathToday + File.separator + no +format;
File targetFile = new File(uploadPath+File.separator+realFileRelPath);
FileUtils.copyInputStreamToFile(zipFile.getInputStream(entry),targetFile);
// FileUtils.copyInputStreamToFile(zipFile.getInputStream(entry),targetFile);
realFileRelPath=xx_url+ SystemConfig.RENOVATE+File.separator+realFileRelPath;
result.append(realFileRelPath+",");
}
......
......@@ -101,4 +101,6 @@ public class VehicleDepartureLog {
String departureRemark;
String arrivalRemark;
}
......@@ -4,7 +4,60 @@ import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleDepartureLog;
import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
@Data
public class DepartureLogVo extends VehicleDepartureLog {
VehicleBookRecord vehicleBookRecord;
/**
* 申请开始日期
*/
private Date bookStartDate;
/**
* 申请结束日期
*/
private Date bookEndDate;
/**
* 实际开始日期
*/
private Date actualStartDate;
/**
* 实际结束日期
*/
private Date actualEndDate;
/**
* 车牌号码
*/
private String numberPlate;
/**
* 接受公司
*/
private String arrivalName;
/**
* 出车公司
*/
private String departureName;
/**
* 公里数统计
*/
private Integer mileage;
/**
* 时间天数统计
*/
private String departureDay;
/**
* 内部用途备注
*/
private String remark;
}
......@@ -276,8 +276,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
String realFileRelPath = dirPathToday + File.separator + no + fileName.substring(fileName.lastIndexOf("."));
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
//将文件写入指定位置 FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
......
......@@ -225,7 +225,7 @@ public class BranchCompanyStockService {
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
......
......@@ -175,8 +175,7 @@ public class CampsiteBiz extends BaseBiz<CampsiteMapper, Campsite> {
String realFileRelPath = dirPathToday + File.separator + no + fileName.substring(fileName.lastIndexOf("."));
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
//将文件写入指定位置 FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
......
......@@ -128,8 +128,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
String realFileRelPath = dirPathToday + File.separator + no + fileName.substring(fileName.lastIndexOf("."));
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
//将文件写入指定位置 FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
......
......@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.universal.utils.DateUtil;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.BookType;
......@@ -30,6 +31,7 @@ import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import com.xxfc.platform.universal.feign.ThirdFeign;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -38,13 +40,14 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import com.xxfc.platform.universal.entity.Dictionary;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_FALSE;
import static com.xxfc.platform.universal.constant.DictionaryKey.VEHICE_ORDER;
import static com.xxfc.platform.universal.constant.DictionaryKey.RESERVE;
@Service
@Slf4j
public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, VehicleBookRecord> implements UserRestInterface {
......@@ -86,6 +89,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
@Autowired
VehicleBiz vehicleBiz;
@Autowired
ThirdFeign thirdFeign;
@Override
public UserFeign getUserFeign() {
return userFeign;
......@@ -100,6 +106,14 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
removeStatus2(list);
return list;
}
/**
* 车辆用途字典查询
*/
public ObjectRestResponse<OrderPageVO> getOrderDetail() {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
String reserveType = dictionaryMap.get(VEHICE_ORDER + "_" +RESERVE).getName();
return ObjectRestResponse.succ(reserveType);
}
public List<VehicleBookRecordVo> selectZeroHourRecord(Map<String, Object> param) {
List<VehicleBookRecordVo> list = mapper.selectZeroHourRecord(param);
......
......@@ -34,17 +34,17 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
@Autowired
VehicleMapper vehicleMapper;
public PageInfo<VehicleDepartureLogVo> page(String numberPlate,Integer code,Integer zoneId,Integer departureId, String startTime,String endTime, Integer page, Integer limit) {
public PageInfo<VehicleDepartureLogVo> page(String numberPlate,Integer code,Integer zoneId,Integer departureId,Integer arrivalBranchCompanyId,String use ,String startTime,String endTime, Integer page, Integer limit) {
PageHelper.startPage(page, limit);
return new PageInfo<>(mapper.selectVoAll(numberPlate,code,zoneId,departureId,startTime, endTime));
return new PageInfo<>(mapper.selectVoAll(numberPlate,code,zoneId,departureId,arrivalBranchCompanyId,use,startTime,endTime));
}
public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate,Integer code,Integer zoneId,Integer departureId, String startTime,String endTime, Integer page, Integer limit, List<Integer> companyList) {
public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate,Integer code,Integer zoneId,Integer departureId,Integer arrivalBranchCompanyId,String use , String startTime,String endTime, Integer page, Integer limit, List<Integer> companyList) {
PageHelper.startPage(page, limit);
if (companyList == null || companyList.size() == 0) {
companyList = Arrays.asList(-1);
}
return new PageInfo<>(mapper.selectVoAllNotAllData(numberPlate,code,zoneId,departureId,startTime, endTime, companyList));
return new PageInfo<>(mapper.selectVoAllNotAllData(numberPlate,code,zoneId,departureId,arrivalBranchCompanyId,use,startTime, endTime, companyList));
}
public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) {
......
......@@ -20,6 +20,8 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("code") Integer code,
@Param("zoneId") Integer zoneId,
@Param("departureId") Integer departureId,
@Param("arrivalBranchCompanyId") Integer arrivalBranchCompanyId,
@Param("use") String user,
@Param("startTime") String startTime,
@Param("endTime") String endTime
);
......@@ -28,6 +30,8 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("code") Integer code,
@Param("zoneId") Integer zoneId,
@Param("departureId") Integer departureId,
@Param("arrivalBranchCompanyId") Integer arrivalBranchCompanyId,
@Param("use") String user,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("companyList") List<Integer> companyList);
......
......@@ -6,6 +6,9 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.biz.VehicleBiz;
import com.xxfc.platform.vehicle.biz.VehicleDepartureService;
import com.xxfc.platform.vehicle.common.RestResponse;
......@@ -16,6 +19,10 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.RESERVE;
import static com.xxfc.platform.universal.constant.DictionaryKey.VEHICE_ORDER;
@IgnoreClientToken
@RestController
......@@ -30,6 +37,9 @@ public class VehicleDepartureController {
@Autowired
UserFeign userFeign;
@Autowired
ThirdFeign thirdFeign;
@Autowired
private UserAuthConfig userAuthConfig;
......@@ -46,9 +56,13 @@ public class VehicleDepartureController {
@GetMapping("page")
public RestResponse page(String numberPlate,
@RequestParam(value = "code", required = false) Integer code, String startTime, String endTime,
@RequestParam(value = "zoneId",required = false) Integer zoneId,
@RequestParam(value = "zoneId", required = false) Integer zoneId,
@RequestParam(value = "departureId", required = false) Integer departureId,
@RequestParam(value = "use", required = false) String use,
@RequestParam(value = "arrivalBranchCompanyId", required = false) Integer arrivalBranchCompanyId,
Integer page, Integer limit, HttpServletRequest request) {
if (page == null || limit == null) {
page = 1;
limit = 10;
......@@ -57,15 +71,15 @@ public class VehicleDepartureController {
if (userDTO != null) {
if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, zoneId,departureId, startTime, endTime, page, limit, companyList));
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, zoneId, departureId, arrivalBranchCompanyId, use, startTime, endTime, page, limit, companyList));
}
}
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, zoneId,departureId, startTime, endTime, page, limit));
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, zoneId, departureId, arrivalBranchCompanyId, use, startTime, endTime, page, limit));
}
@GetMapping("small/page")
@IgnoreUserToken
public RestResponse pageBySmall(String numberPlate, @RequestParam(value = "code", required = false) Integer code, String startTime, String endTime,Integer page, Integer limit, Integer uid, HttpServletRequest request) {
public RestResponse pageBySmall(String numberPlate, @RequestParam(value = "code", required = false) Integer code, String startTime, String endTime, Integer page, Integer limit, Integer uid, HttpServletRequest request) {
if (page == null || limit == null) {
page = 1;
limit = 10;
......@@ -74,10 +88,10 @@ public class VehicleDepartureController {
if (userDTO != null) {
if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, null,null, startTime,endTime, page, limit, companyList));
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, null, null, null, null, startTime, endTime, page, limit, companyList));
}
}
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, null,null, startTime,endTime, page, limit));
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, null, null, null, null, startTime, endTime, page, limit));
}
/**
......@@ -147,5 +161,15 @@ public class VehicleDepartureController {
return vehicleDepartureService.collect(vdl);
}
/**
* 车辆用途字典查询
*/
@GetMapping("findReserveType")
public ObjectRestResponse<OrderPageVO> getOrderDetail() {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
String reserveType = dictionaryMap.get(VEHICE_ORDER + "_" + RESERVE).getName();
return ObjectRestResponse.succ(reserveType);
}
}
......@@ -3,8 +3,8 @@
<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"
<result column="book_record_id" property="bookRecordId" />
<association property="bookRecordId" column="bookRecordId" javaType="java.lang.Long"
select="com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.selectOne"/>
</resultMap>
<select id="selectLastByVehicleId" resultType="com.xxfc.platform.vehicle.entity.VehicleDepartureLog">
......@@ -85,18 +85,24 @@
</where>
</select>
<select id="selectVoAll" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo">
select vehicle_departure_log.*,vehicle.number_plate,
/* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD 86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
<select id="selectVoAll" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,bc2.remark,
IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0),
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD
86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
as departureDay,bc.name as departureName,bc1.name as arrivalName,
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) as mileage
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0)
as mileage
from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id
LEFT JOIN vehicle_book_record bc2 ON vehicle_departure_log.book_record_id = bc2.id
<trim prefix="where">
1=1
<if test="numberPlate != null and numberPlate != ''">
......@@ -107,32 +113,44 @@
vehicle_departure_log.departure_time &gt;= str_to_date(#{startTime}, '%Y-%m-%d %H')
</if>
<if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time &gt;= str_to_date(#{endTime}, '%Y-%m-%d %H')
and vehicle_departure_log.arrival_time &gt;= str_to_date(#{endTime}, '%Y-%m-%d %H')
</if>
<if test="code!=null">
and vehicle.code=#{code}
and vehicle.code=#{code}
</if>
<if test="zoneId!=null">
and bc.zone_id=#{zoneId}
and bc.zone_id=#{zoneId}
</if>
<if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId}
and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if>
<if test="use!=null">
and bc2.book_type=#{use}
</if>
<if test="arrivalBranchCompanyId!=null">
and vehicle_departure_log.arrival_branch_company_id=#{arrivalBranchCompanyId}
</if>
</trim>
order by create_time desc
</select>
<select id="selectVoAllNotAllData" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo">
select vehicle_departure_log.*,vehicle.number_plate,
/*IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD 86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
<select id="selectVoAllNotAllData" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,bc2.remark,
IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0),
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD
86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
as departureDay,bc.name as departureName,bc1.name as arrivalName,
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) as mileage
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0)
as mileage
from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id
LEFT JOIN vehicle_book_record bc2 ON vehicle_departure_log.book_record_id = bc2.id
<trim prefix="where" suffixOverrides="and">
<if test="numberPlate != null and numberPlate != ''">
vehicle.number_plate = #{numberPlate} and
......@@ -162,18 +180,24 @@
</if>
<if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time >= str_to_date(#{endTime}, '%Y-%m-%d %H')
and vehicle_departure_log.arrival_time >= str_to_date(#{endTime}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{endTime}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null
</if>
<if test="code!=null">
and vehicle.code=#{code}
and vehicle.code=#{code}
</if>
<if test="zoneId!=null">
and bc.zone_id=#{zoneId}
and bc.zone_id=#{zoneId}
</if>
<if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId}
and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if>
<if test="use!=null">
and bc2.book_type=#{use}
</if>
<if test="arrivalBranchCompanyId!=null">
and vehicle_departure_log.arrival_branch_company_id=#{arrivalBranchCompanyId}
</if>
</trim>
order by create_time desc
......
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