Commit 44b42b01 authored by hezhen's avatar hezhen

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

# Conflicts:
#	ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
#	ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
parents 9a2e9989 39114f9c
package com.github.wxiaoqi.security.admin.feign;
import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
......@@ -12,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
* ${DESCRIPTION}
......@@ -40,9 +38,6 @@ public interface UserFeign {
@RequestMapping(value = "/member/levels", method = RequestMethod.GET)
public List<BaseUserMemberLevel> levels();
@RequestMapping(value = "/public/app/userinfo-by-id")
public Map<Integer, AppUserVo> userDetailById(List<Integer> userids);
@RequestMapping(value = "/app/user/getByUserIds", method = RequestMethod.GET)
public ObjectRestResponse<List<AppUserVo>> getByUserIds(@RequestParam("ids")List<Integer> ids);
}
package com.github.wxiaoqi.security.admin.rest;
import com.ace.cache.annotation.Cache;
import com.github.wxiaoqi.security.admin.biz.AppUserBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserDetailBiz;
import com.github.wxiaoqi.security.admin.entity.AppUser;
......@@ -20,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -128,5 +130,13 @@ public class AppUserController extends CommonBaseController {
return ObjectRestResponse.succ();
}
@GetMapping("/findByUserId")
public ObjectRestResponse<AppUserDetail> findByUserId(Integer id) {
if(id == null || id < 0) {
return ObjectRestResponse.createFailedResult(500, "参数id为空");
}
AppUserDetail appUserDetail = userDetailBiz.getUserByUserid(id);
return ObjectRestResponse.succ(appUserDetail);
}
}
......@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -84,22 +85,18 @@ public class PublicController {
return new ObjectRestResponse<AppUserDetail>().rel(true).data(user);
}
//批量获取用户信息
@RequestMapping(value = "/app/userinfo-by-id", method = RequestMethod.GET)
public @ResponseBody
Map<Integer,AppUserVo> userDetailById(List<Integer> userids) throws Exception {
Map<Integer,AppUserVo> map=new HashMap<>();
for (Integer userid:userids) {
AppUserVo userVo = detailBiz.getUserInfoById(userid);
if (userVo == null) {
userVo=new AppUserVo();
userVo.setHeadimgurl(SystemConfig.USER_HEADER_URL_DEFAULT);
userVo.setUserid(userid);
@GetMapping("/getByUserIds")
public ObjectRestResponse<List<AppUserVo>> getByUserIds(@RequestParam("ids") List<Integer> ids) {
if(ids == null) {
return ObjectRestResponse.createFailedResult(500, "参数id为空");
}
map.put(userid,userVo);
List<AppUserVo> appUserVos = new ArrayList<>();
for (Integer id : ids) {
AppUserVo userVo = detailBiz.getUserInfoById(id);
appUserVos.add(userVo);
}
return map;
return ObjectRestResponse.succ(appUserVos);
}
......
......@@ -104,6 +104,7 @@ public class UserController extends CommonBaseController {
}
}
@RequestMapping(value = "/front/menus", method = RequestMethod.GET)
public @ResponseBody
List<MenuTree> getMenusByUsername(String token) throws Exception {
......
......@@ -194,7 +194,7 @@ public class BaseOrder implements Serializable {
*/
@Column(name = "has_discount")
@ApiModelProperty(value = "是否有优惠")
private Integer hasDiscount;
private Long hasDiscount;
/**
* 是否已支付
......@@ -202,4 +202,11 @@ public class BaseOrder implements Serializable {
@Column(name = "has_pay")
@ApiModelProperty(value = "是否已支付")
private Integer hasPay;
@Transient
private String username;
@Transient
private String vehicalNumberPlat;
}
......@@ -2,7 +2,6 @@ package com.xxfc.platform.order.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import javax.persistence.*;
@Table(name = "order_vehicle_crosstown")
@Data
@RequiredArgsConstructor
public class OrderVehicaleCrosstown {
/**
* 主键id
*/
@Id
private Integer id;
/**
* 订单id
*/
@Column(name = "order_id")
private Integer orderId;
/**
* 订单号
*/
@Column(name = "order_no")
private String orderNo;
/**
* 驾驶人
*/
@Column(name = "license_name")
private String licenseName;
/**
* 驾驶人手机号
*/
@Column(name = "license_phone")
private String licensePhone;
/**
* 驾驶证照
*/
@Column(name = "license_img")
private String licenseImg;
/**
* 公里数(公里)
*/
private Integer mileage;
/**
* 公里数取证照
*/
@Column(name = "mileage_img")
private String mileageImg;
/**
* 审核状态;0-未审核;1-已审核
*/
private Boolean status;
/**
* 审核时间
*/
@Column(name = "status_time")
private Long statusTime;
/**
* 审核名称
*/
@Column(name = "status_name")
private String statusName;
/**
* 审核人id
*/
@Column(name = "status_id")
private Integer statusId;
/**
* 是否删除;0-正常;1-删除
*/
@Column(name = "is_del")
private Boolean isDel;
/**
* 取证图片
*/
private String imgs;
/**
* 备注
*/
private String remak;
/**
* 创建时间
*/
private Long crtTime;
/**
* 更新时间
*/
private Long updTime;
/**
* 钥匙图片
*/
private String vehicleKey;
/**
* 是否有扣除项
*/
private Boolean isDed;
/**
* 扣除项明细
*/
private String dedDetail;
/**
* 驾驶人身份证号
*/
private String licenseIdCard;
/**
* 1、交车, 2、还车
*/
private Integer type;
}
\ No newline at end of file
......@@ -25,7 +25,6 @@
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
......@@ -50,6 +49,11 @@
<version>5.1.30</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
......
......@@ -48,6 +48,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
public List<OrderPageVO> listOrder(Map<String, Object> paramMap){
return mapper.listOrder(paramMap);
}
public List<OrderPageVO> getRentVehicle (Map<String, Object> paramMap) {
return mapper.getRentVehicle(paramMap);
}
private static Map<Integer, List<Integer>> cancelAble;
static {
cancelAble = new HashMap<Integer, List<Integer>>();
......
package com.xxfc.platform.order.biz;
import com.ace.cache.annotation.Cache;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import com.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapper, OrderVehicaleCrosstown> {
public OrderVehicaleCrosstown get(Integer id){
return selectById(id);
}
public List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicaleCrosstown orderVehicaleCrosstown) {
return mapper.selectByOrderId(orderVehicaleCrosstown);
}
}
package com.xxfc.platform.order.config;
import feign.RequestInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
/**
* 自定义的请求头处理类,处理服务发送时的请求头;
* 将服务接收到的请求头中的uniqueId和token字段取出来,并设置到新的请求头里面去转发给下游服务
* 比如A服务收到一个请求,请求头里面包含uniqueId和token字段,A处理时会使用Feign客户端调用B服务
* 那么uniqueId和token这两个字段就会添加到请求头中一并发给B服务;
*
* @author mozping
* @version 1.0
* @date 2018/6/27 14:13
* @see FeignHeadConfiguration
* @since JDK1.8
*/
@Configuration
@Slf4j
public class FeignHeadConfiguration {
@Bean
public RequestInterceptor requestInterceptor() {
return requestTemplate -> {
ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attrs != null) {
HttpServletRequest request = attrs.getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
String value = request.getHeader(name);
/**
* 遍历请求头里面的属性字段,将logId和token添加到新的请求头中转发到下游服务
* */
if ("Authorization".equalsIgnoreCase(name)) {
log.debug("添加自定义请求头key:" + name + ",value:" + value);
requestTemplate.header(name, value);
} else {
log.debug("FeignHeadConfiguration", "非自定义请求头key:" + name + ",value:" + value + "不需要添加!");
}
}
} else {
log.warn("FeignHeadConfiguration", "获取请求头失败!");
}
}
};
}
}
......@@ -17,4 +17,5 @@ import java.util.Map;
public interface BaseOrderMapper extends Mapper<BaseOrder> {
public List<OrderPageVO> pageByParm(Map<String, Object> paramMap);
public List<OrderPageVO> listOrder(Map<String, Object> paramMap);
public List<OrderPageVO> getRentVehicle(Map<String, Object> paramMap);
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface OrderVehicaleCrosstownMapper extends Mapper<OrderVehicaleCrosstown> {
List<OrderVehicaleCrosstown> selectByOrderId(OrderVehicaleCrosstown orderVehicaleCrosstown);
}
\ No newline at end of file
package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.biz.OrderVehicalCrosstownBiz;
import com.xxfc.platform.order.entity.OrderVehicaleCrosstown;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/orderVehicle")
@Api(value = "交还车记录", tags = {"交还车记录"})
@Slf4j
public class OrderVehicleCrosstownController {
@Autowired
OrderVehicalCrosstownBiz orderVehicalCrosstownBiz;
@PostMapping(value = "/add")
@ApiOperation(value = "添加交还车记录")
public ObjectRestResponse<?> add(OrderVehicaleCrosstown orderVehicaleCrosstown) {
log.info("添加的参数:orderVehicaleCrosstown = {}", orderVehicaleCrosstown);
if (orderVehicaleCrosstown == null) {
return ObjectRestResponse.createFailedResult(500, "参数为空!");
}
if (orderVehicaleCrosstown.getId() != null) {
OrderVehicaleCrosstown oldValue = orderVehicalCrosstownBiz.get(orderVehicaleCrosstown.getId());
if (oldValue != null) {
BeanUtil.copyProperties(orderVehicaleCrosstown, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
orderVehicalCrosstownBiz.updateSelectiveById(oldValue);
return ObjectRestResponse.succ();
}
orderVehicalCrosstownBiz.insertSelective(orderVehicaleCrosstown);
return ObjectRestResponse.succ();
} else {
orderVehicalCrosstownBiz.insertSelective(orderVehicaleCrosstown);
return ObjectRestResponse.succ();
}
}
@GetMapping(value = "/{id}")
@ApiOperation(value = "查询记录信息")
public ObjectRestResponse<OrderVehicaleCrosstown> get(@PathVariable Integer id) {
return ObjectRestResponse.succ(orderVehicalCrosstownBiz.get(id));
}
@GetMapping(value = "/getByOrderId")
@ApiOperation(value = "根据订单Id获取所有记录信息")
public ObjectRestResponse<List<OrderVehicaleCrosstown>> getByOrderId(OrderVehicaleCrosstown orderVehicaleCrosstown) {
if (orderVehicaleCrosstown == null) {
return ObjectRestResponse.createFailedResult(500, "参数orderId为空");
}
return ObjectRestResponse.succ(orderVehicalCrosstownBiz.selectByOrderId(orderVehicaleCrosstown));
}
}
......@@ -27,7 +27,7 @@
<javaClientGenerator targetPackage="${targetMapperPackage}" targetProject="${targetJavaProject}"
type="XMLMAPPER"/>
<!-- <table tableName="vehicle" domainObjectName="Vehicle">-->
<!-- <table tableName="order_vehicle_crosstown" domainObjectName="Vehicle">-->
<!-- </table>-->
<!-- <table tableName="vehicle_book_info" domainObjectName="VehicleBookInfo">-->
<!-- </table>-->
......@@ -37,7 +37,7 @@
<!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table tableName="base_order" domainObjectName="baseOrder"></table>
<table tableName="order_vehicle_crosstown" domainObjectName="OrderVehicaleCrosstown"></table>
<!-- <table tableName="vehicle_upkeep_log" domainObjectName="VehicleUpkeepLog"></table>-->
</context>
</generatorConfiguration>
\ No newline at end of file
......@@ -68,6 +68,9 @@
</if>
<if test="status != null">
and b.status = #{status}
</if>
<if test="type != null">
and b.type = #{type}
</if>
<if test="no != null">
and no like CONCAT ("%", #{no}, "%")
......@@ -80,6 +83,34 @@
and r.start_company_id = #{startCompanyId}
or t.start_company_id = #{startCompanyId}
</if>
<if test="startZoneId != null">
and r.start_zone_id = #{startZoneId}
or t.start_zone_id = #{startZoneId}
</if>
</where>
order by b.crt_time desc
</select>
<select id="getRentVehicle" parameterType="Map" resultMap="orderPageMap">
select b.*
from base_order b
LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id
<where>
<if test="userId != null">
and b.user_id = #{userId}
</if>
<if test="status != null">
and b.status = #{status}
</if>
<if test="no != null">
and no like CONCAT ("%", #{no}, "%")
</if>
<if test="startTime != null">
and r.start_time between #{startTime} and #{endTime}
</if>
<if test="startCompanyId != null">
and r.start_company_id = #{startCompanyId}
</if>
</where>
order by b.crt_time desc
</select>
......
<?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.OrderVehicaleCrosstownMapper">
<resultMap id="BaseResultMap" type="com.xxfc.platform.order.entity.OrderVehicaleCrosstown">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="order_id" jdbcType="INTEGER" property="orderId" />
<result column="order_no" jdbcType="VARCHAR" property="orderNo" />
<result column="license_name" jdbcType="VARCHAR" property="licenseName" />
<result column="license_phone" jdbcType="VARCHAR" property="licensePhone" />
<result column="license_img" jdbcType="VARCHAR" property="licenseImg" />
<result column="mileage" jdbcType="INTEGER" property="mileage" />
<result column="mileage_img" jdbcType="VARCHAR" property="mileageImg" />
<result column="status" jdbcType="BIT" property="status" />
<result column="status_time" jdbcType="BIGINT" property="statusTime" />
<result column="status_name" jdbcType="VARCHAR" property="statusName" />
<result column="status_id" jdbcType="INTEGER" property="statusId" />
<result column="is_del" jdbcType="BIT" property="isDel" />
<result column="imgs" jdbcType="LONGVARCHAR" property="imgs" />
<result column="remak" jdbcType="LONGVARCHAR" property="remak" />
<result column="crt_time" jdbcType="BIGINT" property="crtTime" />
<result column="upd_time" jdbcType="BIGINT" property="updTime" />
<result column="vehicle_key" jdbcType="LONGVARCHAR" property="vehicleKey"/>
<result column="license_id_card" jdbcType="VARCHAR" property="licenseIdCard"/>
<result column="is_ded" jdbcType="BIT" property="isDeD" />
<result column="ded_detail" jdbcType="LONGVARCHAR" property="dedDetail" />
<result column="type" jdbcType="INTEGER" property="type"/>
</resultMap>
<select id="selectByOrderId" parameterType="com.xxfc.platform.order.entity.OrderVehicaleCrosstown" resultMap="BaseResultMap">
select *
from order_vehicle_crosstown
<where>
<if test="status != null">
and status = #{status}
</if>
<if test="type != null">
and type = #{type}
</if>
<if test="orderId != null">
and order_id = #{orderId}
</if>
<if test="orderNo != null">
and order_no = #{orderNo}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -2,14 +2,15 @@ package com.xxfc.platform.vehicle.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.pojo.BookVehicleVO;
import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.RentVehicleBookDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by ace on 2017/9/15.
*/
......@@ -18,6 +19,15 @@ public interface VehicleFeign {
@GetMapping(value = "/vehicleModel/{id}")
public ObjectRestResponse<VehicleModel> get(@PathVariable("id") int id);
@GetMapping(value = "/vehicleInfo/{id}")
public ObjectRestResponse<Vehicle> get(@PathVariable("id") String id);
@RequestMapping(value = "/vehicleInfo/findById", method = RequestMethod.GET)
public RestResponse<Vehicle> findById(@RequestParam("id")String id);
@RequestMapping(value = "/vehicleInfo/getByIds", method = RequestMethod.GET)
public RestResponse< List<Vehicle>> getByIds(@RequestParam("ids") List<String> id);
//修改评分
@RequestMapping(value = "/vehicleModel/app/addScore", method = RequestMethod.GET)
public RestResponse addScore(@RequestParam(value="id")Integer id, @RequestParam(value="score")Integer score);
......
......@@ -2,6 +2,7 @@ package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.ace.cache.annotation.Cache;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
......@@ -121,6 +122,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
}
@Cache(key = "vehical")
public Vehicle get(String id){
return mapper.selectByPrimaryKey(id);
}
......
package com.xxfc.platform.vehicle.rest;
import cn.hutool.core.bean.BeanUtil;
import com.ace.cache.annotation.Cache;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
......@@ -94,6 +95,26 @@ public class VehicleController extends BaseController<VehicleBiz> {
return baseBiz.discard(idList);
}
@RequestMapping(value = "/findById", method = RequestMethod.GET)
public RestResponse<Vehicle> findById(String id) {
Vehicle vehicle = baseBiz.get(id);
return RestResponse.data(vehicle);
}
@RequestMapping(value = "/vehicleInfo/getByIds", method = RequestMethod.GET)
public RestResponse< List<Vehicle>> getByIds(@RequestParam("ids") List<String> ids){
if(ids == null) {
return RestResponse.codeAndMessage(500, "参数为空!");
}
List<Vehicle> vehicles = new ArrayList<>();
for(String id : ids) {
log.info("查询车辆信息Id:{}",id);
Vehicle vehicle = baseBiz.get(id);
vehicles.add(vehicle);
}
return RestResponse.suc(vehicles);
}
@RequestMapping(value = "/page", method = RequestMethod.GET)
public RestResponse<PageDataVO<QueryVehicleVo>> getByPage(@RequestParam String vehiclePageQueryVoJson) throws Exception {
VehiclePageQueryVo vehiclePageQueryVo = null;
......
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