Commit ffdeef22 authored by zuoyh's avatar zuoyh

Merge branch 'feature-vehicle-tripp' into dev

parents fbca434d 53484a1b
...@@ -53,9 +53,9 @@ ...@@ -53,9 +53,9 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>1.3.2</version> <version>2.5</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -5,7 +5,17 @@ public class DictionaryKey { ...@@ -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 { ...@@ -21,36 +31,36 @@ public class DictionaryKey {
/** /**
* IM类型 * IM类型
*/ */
public static final String IM_TYPE ="IM_TYPE"; public static final String IM_TYPE = "IM_TYPE";
/** /**
* IM限制条数 * 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 RENT_REFUND = "RENT_REFUND";
public static final String TOUR_REFUND ="TOUR_REFUND"; public static final String TOUR_REFUND = "TOUR_REFUND";
public static final String TOUR_IN_REFUND ="TOUR_IN_REFUND"; public static final String TOUR_IN_REFUND = "TOUR_IN_REFUND";
/** /**
* 租车:公司司机租金、免赔费用、违章预备金 * 租车:公司司机租金、免赔费用、违章预备金
*/ */
public static final String DRIVER_PRICE ="DRIVER_PRICE"; public static final String DRIVER_PRICE = "DRIVER_PRICE";
public static final String DAMAGE_SAFE ="DAMAGE_SAFE"; public static final String DAMAGE_SAFE = "DAMAGE_SAFE";
public static final String ILLEGAL_RESERVE = "ILLEGAL_RESERVE"; public static final String ILLEGAL_RESERVE = "ILLEGAL_RESERVE";
public static final String RENT_TIME_BUFFER = "RENT_TIME_BUFFER"; 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,6 +69,8 @@ public interface ThirdFeign { ...@@ -69,6 +69,8 @@ public interface ThirdFeign {
@RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET) @RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET)
public ObjectRestResponse<Map<String, Dictionary>> dictionaryGetAll4Map(); public ObjectRestResponse<Map<String, Dictionary>> dictionaryGetAll4Map();
@RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET)
public ObjectRestResponse<Map<String, Dictionary>> getDictionaryUseType();
@PostMapping("/dictionary/type_code") @PostMapping("/dictionary/type_code")
public Dictionary findDictionaryByTypeAndCode(@RequestParam(value = "type") String type,@RequestParam(value = "code") String code); public Dictionary findDictionaryByTypeAndCode(@RequestParam(value = "type") String type,@RequestParam(value = "code") String code);
......
...@@ -25,17 +25,17 @@ import static com.xxfc.platform.universal.constant.RedisKey.*; ...@@ -25,17 +25,17 @@ import static com.xxfc.platform.universal.constant.RedisKey.*;
public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> { public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
public ObjectRestResponse add(Dictionary dictionary) { public ObjectRestResponse add(Dictionary dictionary) {
if(dictionary == null) if (dictionary == null)
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
List<Dictionary> dictionaryVos = mapper.selectByCodeAndType(dictionary); 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)); BeanUtil.copyProperties(dictionary, dictionaryVos.get(0), CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
mapper.updateByPrimaryKeySelective(dictionaryVos.get(0)); mapper.updateByPrimaryKeySelective(dictionaryVos.get(0));
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
if(dictionary.getPid() != null) {//有父类 判断是否存在 if (dictionary.getPid() != null) {//有父类 判断是否存在
Dictionary parent = mapper.selectByPrimaryKey(dictionary.getPid()); Dictionary parent = mapper.selectByPrimaryKey(dictionary.getPid());
if(parent == null) { if (parent == null) {
log.info("pid所属数据不存在, dictionary = {}", dictionary); log.info("pid所属数据不存在, dictionary = {}", dictionary);
return ObjectRestResponse.createFailedResult(500, "pid所属数据不存在"); return ObjectRestResponse.createFailedResult(500, "pid所属数据不存在");
} }
...@@ -47,11 +47,11 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> { ...@@ -47,11 +47,11 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
} }
public ObjectRestResponse<List<Dictionary>> get(Dictionary dictionary) { public ObjectRestResponse<List<Dictionary>> get(Dictionary dictionary) {
if(dictionary == null) { if (dictionary == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary); List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary);
for(Dictionary parent : dictionaryList) { for (Dictionary parent : dictionaryList) {
Set<Dictionary> dictionaryVoList = buildTree(parent.getId()); Set<Dictionary> dictionaryVoList = buildTree(parent.getId());
parent.setChildrens(dictionaryVoList); parent.setChildrens(dictionaryVoList);
} }
...@@ -60,12 +60,12 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> { ...@@ -60,12 +60,12 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
} }
public ObjectRestResponse deleteByEntity(Dictionary dictionary) { public ObjectRestResponse deleteByEntity(Dictionary dictionary) {
if(dictionary == null) { if (dictionary == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
//删除所有子元素 //删除所有子元素
Set<Dictionary> childrens = mapper.selectByPid(dictionary.getId()); Set<Dictionary> childrens = mapper.selectByPid(dictionary.getId());
if(childrens.size() > 0) { if (childrens.size() > 0) {
childrens.forEach((a) -> mapper.deleteByPrimaryKey(a)); childrens.forEach((a) -> mapper.deleteByPrimaryKey(a));
} }
mapper.deleteByPrimaryKey(dictionary); mapper.deleteByPrimaryKey(dictionary);
...@@ -73,7 +73,7 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> { ...@@ -73,7 +73,7 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
} }
public ObjectRestResponse update(Dictionary dictionary) { public ObjectRestResponse update(Dictionary dictionary) {
if(StringUtils.isEmpty(dictionary)) { if (StringUtils.isEmpty(dictionary)) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
Dictionary oldValue = mapper.selectByPrimaryKey(dictionary.getId()); Dictionary oldValue = mapper.selectByPrimaryKey(dictionary.getId());
...@@ -83,7 +83,7 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> { ...@@ -83,7 +83,7 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
} }
public ObjectRestResponse<List<Dictionary>> getParent(String type) { public ObjectRestResponse<List<Dictionary>> getParent(String type) {
if(StringUtils.isEmpty(type)) { if (StringUtils.isEmpty(type)) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
List<Dictionary> dictionaryList = getParentCommon(type); List<Dictionary> dictionaryList = getParentCommon(type);
...@@ -95,7 +95,7 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> { ...@@ -95,7 +95,7 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
dictionary.setType(type); dictionary.setType(type);
dictionary.setPid(0); dictionary.setPid(0);
List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary); List<Dictionary> dictionaryList = mapper.selectByCodeAndType(dictionary);
for(Dictionary parent : dictionaryList) { for (Dictionary parent : dictionaryList) {
Set<Dictionary> dictionaryVoList = buildTree(parent.getId()); Set<Dictionary> dictionaryVoList = buildTree(parent.getId());
parent.setChildrens(dictionaryVoList); parent.setChildrens(dictionaryVoList);
} }
...@@ -103,29 +103,37 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> { ...@@ -103,29 +103,37 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
} }
@Cache(key = CACHE_DICTIONARY_ALL_MAP) @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 = this.getParentCommon(null);
List<Dictionary> dictionaries = selectListAll(); 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)); , Function.identity(), (oldValue, newValue) -> newValue));
dictionaryMap.forEach((k,v) -> { dictionaryMap.forEach((k, v) -> {
v.setChildrens(buildTree(v.getId())); v.setChildrens(buildTree(v.getId()));
}); });
return dictionaryMap; 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) @CacheClear(pre = CACHE_DICTIONARY_PREFIX)
public void clear(){ public void clear() {
; ;
} }
public DictionaryVo buidTree(Dictionary dictionary) { public DictionaryVo buidTree(Dictionary dictionary) {
DictionaryVo dictionaryVo = new DictionaryVo(); DictionaryVo dictionaryVo = new DictionaryVo();
if(dictionary.getPid() == 0) { if (dictionary.getPid() == 0) {
BeanUtil.copyProperties(dictionary, dictionaryVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); BeanUtil.copyProperties(dictionary, dictionaryVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
Set<Dictionary> childrens = mapper.selectByPid(dictionary.getId()); Set<Dictionary> childrens = mapper.selectByPid(dictionary.getId());
dictionaryVo.setChildrens(childrens); dictionaryVo.setChildrens(childrens);
for(Dictionary children : childrens) { for (Dictionary children : childrens) {
buidTree(children); buidTree(children);
} }
} }
......
...@@ -4,7 +4,28 @@ import com.xxfc.platform.vehicle.entity.VehicleBookRecord; ...@@ -4,7 +4,28 @@ import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleDepartureLog; import com.xxfc.platform.vehicle.entity.VehicleDepartureLog;
import lombok.Data; import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
@Data @Data
public class DepartureLogVo extends VehicleDepartureLog { public class DepartureLogVo extends VehicleDepartureLog {
VehicleBookRecord vehicleBookRecord; VehicleBookRecord vehicleBookRecord;
/**
* 申请开始日期
*/
private Date bookStartDate;
/**
* 申请结束日期
*/
private Date bookEndDate;
/**
* 实际开始日期
*/
private Date actualStartDate;
/**
* 实际结束日期
*/
private Date actualEndDate;
} }
...@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO; ...@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
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.pojo.order.OrderPageVO;
import com.xxfc.platform.universal.utils.DateUtil; import com.xxfc.platform.universal.utils.DateUtil;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.BookType; import com.xxfc.platform.vehicle.constant.BookType;
...@@ -30,6 +31,7 @@ import org.apache.commons.beanutils.PropertyUtils; ...@@ -30,6 +31,7 @@ import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import com.xxfc.platform.universal.feign.ThirdFeign;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -38,13 +40,14 @@ import org.springframework.scheduling.annotation.Scheduled; ...@@ -38,13 +40,14 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import com.xxfc.platform.universal.entity.Dictionary;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_FALSE; 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 @Service
@Slf4j @Slf4j
public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, VehicleBookRecord> implements UserRestInterface { public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, VehicleBookRecord> implements UserRestInterface {
...@@ -86,6 +89,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -86,6 +89,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
@Autowired @Autowired
VehicleBiz vehicleBiz; VehicleBiz vehicleBiz;
@Autowired
ThirdFeign thirdFeign;
@Override @Override
public UserFeign getUserFeign() { public UserFeign getUserFeign() {
return userFeign; return userFeign;
...@@ -100,6 +106,14 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -100,6 +106,14 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
removeStatus2(list); removeStatus2(list);
return 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) { public List<VehicleBookRecordVo> selectZeroHourRecord(Map<String, Object> param) {
List<VehicleBookRecordVo> list = mapper.selectZeroHourRecord(param); List<VehicleBookRecordVo> list = mapper.selectZeroHourRecord(param);
......
...@@ -34,17 +34,17 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, ...@@ -34,17 +34,17 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
@Autowired @Autowired
VehicleMapper vehicleMapper; 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); 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); PageHelper.startPage(page, limit);
if (companyList == null || companyList.size() == 0) { if (companyList == null || companyList.size() == 0) {
companyList = Arrays.asList(-1); 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) { public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) {
......
...@@ -20,6 +20,8 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo ...@@ -20,6 +20,8 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("code") Integer code, @Param("code") Integer code,
@Param("zoneId") Integer zoneId, @Param("zoneId") Integer zoneId,
@Param("departureId") Integer departureId, @Param("departureId") Integer departureId,
@Param("arrivalBranchCompanyId") Integer arrivalBranchCompanyId,
@Param("use") String user,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime @Param("endTime") String endTime
); );
...@@ -28,6 +30,8 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo ...@@ -28,6 +30,8 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("code") Integer code, @Param("code") Integer code,
@Param("zoneId") Integer zoneId, @Param("zoneId") Integer zoneId,
@Param("departureId") Integer departureId, @Param("departureId") Integer departureId,
@Param("arrivalBranchCompanyId") Integer arrivalBranchCompanyId,
@Param("use") String user,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("companyList") List<Integer> companyList); @Param("companyList") List<Integer> companyList);
......
...@@ -6,6 +6,9 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; ...@@ -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.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; 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.VehicleBiz;
import com.xxfc.platform.vehicle.biz.VehicleDepartureService; import com.xxfc.platform.vehicle.biz.VehicleDepartureService;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
...@@ -16,6 +19,10 @@ import org.springframework.web.bind.annotation.*; ...@@ -16,6 +19,10 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; 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 @IgnoreClientToken
@RestController @RestController
...@@ -30,6 +37,9 @@ public class VehicleDepartureController { ...@@ -30,6 +37,9 @@ public class VehicleDepartureController {
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
@Autowired
ThirdFeign thirdFeign;
@Autowired @Autowired
private UserAuthConfig userAuthConfig; private UserAuthConfig userAuthConfig;
...@@ -46,9 +56,13 @@ public class VehicleDepartureController { ...@@ -46,9 +56,13 @@ public class VehicleDepartureController {
@GetMapping("page") @GetMapping("page")
public RestResponse page(String numberPlate, public RestResponse page(String numberPlate,
@RequestParam(value = "code", required = false) Integer code, String startTime, String endTime, @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 = "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) { Integer page, Integer limit, HttpServletRequest request) {
if (page == null || limit == null) { if (page == null || limit == null) {
page = 1; page = 1;
limit = 10; limit = 10;
...@@ -57,15 +71,15 @@ public class VehicleDepartureController { ...@@ -57,15 +71,15 @@ public class VehicleDepartureController {
if (userDTO != null) { if (userDTO != null) {
if (userDTO.getDataAll() == 2) { if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany()); 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") @GetMapping("small/page")
@IgnoreUserToken @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) { if (page == null || limit == null) {
page = 1; page = 1;
limit = 10; limit = 10;
...@@ -74,10 +88,10 @@ public class VehicleDepartureController { ...@@ -74,10 +88,10 @@ public class VehicleDepartureController {
if (userDTO != null) { if (userDTO != null) {
if (userDTO.getDataAll() == 2) { if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany()); 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 { ...@@ -147,5 +161,15 @@ public class VehicleDepartureController {
return vehicleDepartureService.collect(vdl); return vehicleDepartureService.collect(vdl);
} }
/**
* 车辆用途字典查询
*/
@GetMapping("findReserveType")
public ObjectRestResponse<OrderPageVO> getOrderDetail() {
Map<String, Dictionary> dictionaryMap = thirdFeign.getDictionaryUseType().getData();
String reserveType = dictionaryMap.get(VEHICE_ORDER + "_" + RESERVE).getName();
return ObjectRestResponse.succ(reserveType);
}
} }
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<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"> <resultMap id="searchBookRecord" type="com.xxfc.platform.vehicle.pojo.DepartureLogVo">
<result column="book_record_id" property="bookRecordId" jdbcType="INTEGER" javaType="java.lang.Integer"/> <result column="book_record_id" property="bookRecordId" />
<association property="vehicleBookRecord" column="id" <association property="bookRecordId" column="bookRecordId" javaType="java.lang.Long"
select="com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.selectOne"/> select="com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.selectOne"/>
</resultMap> </resultMap>
<select id="selectLastByVehicleId" resultType="com.xxfc.platform.vehicle.entity.VehicleDepartureLog"> <select id="selectLastByVehicleId" resultType="com.xxfc.platform.vehicle.entity.VehicleDepartureLog">
...@@ -85,18 +85,24 @@ ...@@ -85,18 +85,24 @@
</where> </where>
</select> </select>
<select id="selectVoAll" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo"> <select id="selectVoAll" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate, select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,
/* 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)*/
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天', CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) -
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)) / 86400),0),'天',
- 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),'小时') 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, 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 from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id 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 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 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"> <trim prefix="where">
1=1 1=1
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
...@@ -118,21 +124,33 @@ ...@@ -118,21 +124,33 @@
<if test="departureId!=null"> <if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId} and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if> </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> </trim>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectVoAllNotAllData" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo"> <select id="selectVoAllNotAllData" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate, select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,
/*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)*/
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天', CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) -
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)) / 86400),0),'天',
- 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),'小时') 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, 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 from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id 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 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 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"> <trim prefix="where" suffixOverrides="and">
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
vehicle.number_plate = #{numberPlate} and vehicle.number_plate = #{numberPlate} and
...@@ -175,6 +193,12 @@ ...@@ -175,6 +193,12 @@
<if test="departureId!=null"> <if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId} and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if> </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> </trim>
order by create_time desc order by create_time desc
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment