Commit ef02b29b authored by zuoyh's avatar zuoyh

车辆出行

parent e4d8720d
......@@ -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);
}
......
......@@ -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,9 @@ 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);
}
}
......@@ -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+",");
}
......
......@@ -4,7 +4,28 @@ 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;
}
......@@ -270,8 +270,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.getDictionaryUseType().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,
<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,
/* 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),'小时')
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,
<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,
/*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),'小时')
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