Commit 70d2326f authored by jiaorz's avatar jiaorz

修改代码

parent 45422b71
...@@ -86,4 +86,8 @@ public class VehicleDepartureLog { ...@@ -86,4 +86,8 @@ public class VehicleDepartureLog {
* 预约记录id * 预约记录id
*/ */
Integer bookRecordId; Integer bookRecordId;
private String illegalPic;
private Integer illegalAmount;
} }
...@@ -53,4 +53,5 @@ public class VehicleBookRecordQueryVo { ...@@ -53,4 +53,5 @@ public class VehicleBookRecordQueryVo {
private String[] companyIds; private String[] companyIds;
private String upkeepIds; private String upkeepIds;
private Integer userCompany;
} }
\ No newline at end of file
...@@ -28,4 +28,8 @@ public class VehicleBookRecordVo extends VehicleBookRecord { ...@@ -28,4 +28,8 @@ public class VehicleBookRecordVo extends VehicleBookRecord {
private VehicleDepartureLogVo vehicleDepartureLogVo; private VehicleDepartureLogVo vehicleDepartureLogVo;
private String numberPlate; private String numberPlate;
private Integer liftStatus;
private Integer retStatus;
} }
...@@ -404,7 +404,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -404,7 +404,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
//转换日期范围为列表,并检查是否合法 //转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay); fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" you can only within 2 month"); throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
} }
//检查车辆是否可以预定 //检查车辆是否可以预定
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){ for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
...@@ -497,7 +497,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -497,7 +497,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
//转换日期范围为列表,并检查是否合法 //转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay); fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" you can only within 2 month"); throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
} }
//检查车辆是否可以预定 //检查车辆是否可以预定
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){ for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
...@@ -747,7 +747,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -747,7 +747,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
//转换日期范围为列表,并检查是否合法 //转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay); fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" you can only within 2 month"); throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
} }
Boolean rs = Boolean.TRUE; Boolean rs = Boolean.TRUE;
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){ for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
...@@ -826,7 +826,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -826,7 +826,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
for( DateTime curDate = startDay;curDate.compareTo(endDay)<=0;curDate=curDate.plusDays(1)){ for( DateTime curDate = startDay;curDate.compareTo(endDay)<=0;curDate=curDate.plusDays(1)){
String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER); String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER);
if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){ if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){
throw new CustomIllegalParamException("you can only unbook from today"); throw new CustomIllegalParamException("只可以取消当前时间之后的车辆");
} }
String curYearMonth = curDate.toString(YEARMONTH_DATE_TIME_FORMATTER); String curYearMonth = curDate.toString(YEARMONTH_DATE_TIME_FORMATTER);
if(!yearMonthAndDate.containsKey(curYearMonth)){ if(!yearMonthAndDate.containsKey(curYearMonth)){
...@@ -837,7 +837,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -837,7 +837,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
} }
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" you can only within 2 month"); throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
} }
} }
...@@ -856,7 +856,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -856,7 +856,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay); fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" you can only within 2 month"); throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
} }
Boolean rs = Boolean.TRUE; Boolean rs = Boolean.TRUE;
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){ for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
...@@ -877,7 +877,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -877,7 +877,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
params.put("yearMonth",yearMonth); params.put("yearMonth",yearMonth);
//加入更新条件 //加入更新条件
if(CollectionUtils.isEmpty(unbookDates)){ if(CollectionUtils.isEmpty(unbookDates)){
throw new CustomIllegalParamException(" there are no day to unbook "); throw new CustomIllegalParamException(" 车辆不可预定");
} }
Map<String,List<String>> yearMonthAndDate = new HashMap<>(); Map<String,List<String>> yearMonthAndDate = new HashMap<>();
yearMonthAndDate.put(yearMonth,unbookDates); yearMonthAndDate.put(yearMonth,unbookDates);
...@@ -904,7 +904,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -904,7 +904,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
public void fillBookedDateSearchParam(Map<String, Object> params, public void fillBookedDateSearchParam(Map<String, Object> params,
Map<String,List<String>> yearMonthAndDate,Map<String,List<String>> yearMonthAndDateNotBooked){ Map<String,List<String>> yearMonthAndDate,Map<String,List<String>> yearMonthAndDateNotBooked){
if(MapUtils.isEmpty(yearMonthAndDate)&&MapUtils.isEmpty(yearMonthAndDateNotBooked)){//没有预定信息查询条件 if(MapUtils.isEmpty(yearMonthAndDate)&&MapUtils.isEmpty(yearMonthAndDateNotBooked)){//没有预定信息查询条件
throw new CustomIllegalParamException(" at least apply one book info condition."); throw new CustomIllegalParamException("没有预订信息!");
} }
Map<String,Map<String,Integer>> yearMonthAndParam = new HashMap<>(); Map<String,Map<String,Integer>> yearMonthAndParam = new HashMap<>();
...@@ -949,7 +949,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -949,7 +949,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
} }
for (String dateStr:entry.getValue()) {//已预定作为条件,该位与1作与运算必定为1 for (String dateStr:entry.getValue()) {//已预定作为条件,该位与1作与运算必定为1
if(bookedYearMonth.contains(dateStr)){ if(bookedYearMonth.contains(dateStr)){
throw new CustomIllegalParamException(" 同一天既作为未预定查询条件又作为已预定查询条件"); throw new CustomIllegalParamException("同一天既作为未预定查询条件又作为已预定查询条件");
} }
DateTime dateTime = DateTime.parse(dateStr, DEFAULT_DATE_TIME_FORMATTER); DateTime dateTime = DateTime.parse(dateStr, DEFAULT_DATE_TIME_FORMATTER);
//仅对应位为1的整形值 //仅对应位为1的整形值
......
...@@ -122,6 +122,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -122,6 +122,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} }
vehicleBookRecordQueryVo.setCompanyIds(companyId.split(",")); vehicleBookRecordQueryVo.setCompanyIds(companyId.split(","));
} }
} else {
vehicleBookRecordQueryVo.setZoneIds((vehicleBookRecordQueryVo.getZoneId() + "").split(","));
vehicleBookRecordQueryVo.setCompanyIds((vehicleBookRecordQueryVo.getLiftCompany() + "").split(","));
} }
List<VehicleBookRecordVo> list = mapper.getBookRecord(vehicleBookRecordQueryVo); List<VehicleBookRecordVo> list = mapper.getBookRecord(vehicleBookRecordQueryVo);
PageHelper.startPage(pageNo,pageSize); PageHelper.startPage(pageNo,pageSize);
...@@ -137,6 +140,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -137,6 +140,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
if(userDTO == null) { if(userDTO == null) {
return RestResponse.codeAndMessage(235, "token失效"); return RestResponse.codeAndMessage(235, "token失效");
} }
vehicleBookRecordQueryVo.setUserCompany(userDTO.getCompanyId());
if(vehicleBookRecordQueryVo.getZoneId() == null) { //默认查出所有权限内的数据 if(vehicleBookRecordQueryVo.getZoneId() == null) { //默认查出所有权限内的数据
if(DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据 if(DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据
String zoneId = null; String zoneId = null;
...@@ -162,6 +166,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -162,6 +166,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} }
vehicleBookRecordQueryVo.setCompanyIds(companyId.split(",")); vehicleBookRecordQueryVo.setCompanyIds(companyId.split(","));
} }
} else {
vehicleBookRecordQueryVo.setZoneIds((vehicleBookRecordQueryVo.getZoneId() + ",").split(","));
vehicleBookRecordQueryVo.setCompanyIds((vehicleBookRecordQueryVo.getLiftCompany() + ",").split(","));
} }
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(vehicleBookRecordQueryVo); List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(vehicleBookRecordQueryVo);
PageHelper.startPage(pageNo,pageSize); PageHelper.startPage(pageNo,pageSize);
......
package com.xxfc.platform.vehicle.biz; package com.xxfc.platform.vehicle.biz;
import com.github.pagehelper.Page; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
...@@ -26,15 +27,12 @@ import java.util.List; ...@@ -26,15 +27,12 @@ import java.util.List;
@Service @Service
public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, VehicleDepartureLog> { public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, VehicleDepartureLog> {
@Autowired
VehicleDepartureLogMapper vehicleDepartureLogMapper;
@Autowired @Autowired
VehicleMapper vehicleMapper; VehicleMapper vehicleMapper;
public PageInfo<VehicleDepartureLogVo> page(String numberPlate, String time, Integer page, Integer limit) { public PageInfo<VehicleDepartureLogVo> page(String numberPlate, String time, Integer page, Integer limit) {
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
return new PageInfo<>(vehicleDepartureLogMapper.selectVoAll(numberPlate, time)); return new PageInfo<>(mapper.selectVoAll(numberPlate, time));
} }
public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate, String time, Integer page, Integer limit, List<Integer> companyList) { public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate, String time, Integer page, Integer limit, List<Integer> companyList) {
...@@ -42,12 +40,12 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, ...@@ -42,12 +40,12 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
if (companyList == null || companyList.size() == 0) { if (companyList == null || companyList.size() == 0) {
companyList = Arrays.asList(-1); companyList = Arrays.asList(-1);
} }
return new PageInfo<>(vehicleDepartureLogMapper.selectVoAllNotAllData(numberPlate, time, companyList)); return new PageInfo<>(mapper.selectVoAllNotAllData(numberPlate, time, companyList));
} }
public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) { public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) {
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
return new PageInfo<>(vehicleDepartureLogMapper.selectByVehicleId(vehicleId)); return new PageInfo<>(mapper.selectByVehicleId(vehicleId));
} }
public VehicleDepartureStatisticDataVo statistic(String numberPlate) { public VehicleDepartureStatisticDataVo statistic(String numberPlate) {
...@@ -61,28 +59,32 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, ...@@ -61,28 +59,32 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
// 出行次数 // 出行次数
VehicleDepartureLog departureLog = new VehicleDepartureLog(); VehicleDepartureLog departureLog = new VehicleDepartureLog();
departureLog.setVehicleId(vehicle.getId()); departureLog.setVehicleId(vehicle.getId());
statisticData.setDepartureCount(vehicleDepartureLogMapper.selectCount(departureLog)); statisticData.setDepartureCount(mapper.selectCount(departureLog));
// 出行天数 // 出行天数
statisticData.setDepartureDay(vehicleDepartureLogMapper.selectDayByVehicleId(vehicle.getId())); statisticData.setDepartureDay(mapper.selectDayByVehicleId(vehicle.getId()));
// 出行公里数 // 出行公里数
statisticData.setDepartureMileage(vehicleDepartureLogMapper.selectMileageByVehicleId(vehicle.getId())); statisticData.setDepartureMileage(mapper.selectMileageByVehicleId(vehicle.getId()));
return statisticData; return statisticData;
} }
@Transactional @Transactional
public ObjectRestResponse save(VehicleDepartureLog vehicleDepartureLog) { public ObjectRestResponse save(VehicleDepartureLog vehicleDepartureLog) {
Integer id = vehicleDepartureLog.getId(); Integer id = vehicleDepartureLog.getId();
if (id == null || id == 0) { if (id == null || id == 0) {
vehicleDepartureLog.setCreateTime(new Date()); vehicleDepartureLog.setCreateTime(new Date());
vehicleDepartureLog.setState(0); vehicleDepartureLog.setState(0);
insertSelective(vehicleDepartureLog); insertSelective(vehicleDepartureLog);
} else { } else {
vehicleDepartureLog.setUpdateTime(new Date()); vehicleDepartureLog.setUpdateTime(new Date());
updateSelectiveById(vehicleDepartureLog); VehicleDepartureLog oldValue = mapper.selectByPrimaryKey(vehicleDepartureLog);
} if(oldValue != null) {
BeanUtil.copyProperties(oldValue, vehicleDepartureLog, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
oldValue.setUpdateTime(new Date());
updateSelectiveById(oldValue);
}
}
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
...@@ -461,13 +461,13 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -461,13 +461,13 @@ public class VehicleController extends BaseController<VehicleBiz> {
} }
@GetMapping(value = "/app/unauth/getBookRecord") @GetMapping(value = "/app/unauth/getBookRecord")
@ApiOperation(value = "获取排班记录") @ApiOperation(value = "获取预定记录")
public RestResponse<PageDataVO> getRecord(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) { public RestResponse<PageDataVO> getRecord(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) {
return vehicleBookRecordBiz.getBookRecord(vehicleBookRecordQueryVo); return vehicleBookRecordBiz.getBookRecord(vehicleBookRecordQueryVo);
} }
@GetMapping(value = "/app/unauth/getBookRecordInfo") @GetMapping(value = "/app/unauth/getBookRecordInfo")
@ApiOperation(value = "获取排班记录信息") @ApiOperation(value = "获取预定记录信息")
public RestResponse<PageDataVO> getBookRecordInfo(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) { public RestResponse<PageDataVO> getBookRecordInfo(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) {
return vehicleBookRecordBiz.getBookRecordInfo(vehicleBookRecordQueryVo); return vehicleBookRecordBiz.getBookRecordInfo(vehicleBookRecordQueryVo);
} }
......
...@@ -417,7 +417,7 @@ ...@@ -417,7 +417,7 @@
<select id="getBookRecordInfo" resultMap="searchBookRecord" parameterType="com.xxfc.platform.vehicle.pojo.VehicleBookRecordQueryVo"> <select id="getBookRecordInfo" resultMap="searchBookRecord" parameterType="com.xxfc.platform.vehicle.pojo.VehicleBookRecordQueryVo">
select bc3.name parkCompanyName,bc4.name subordinateBranchName, conv(v2.booked_date,10,2) book_date, conv(v4.booked_hour,10,2) startHour,conv(v5.booked_hour,10,2) endHour, bc1.`name` lift_company_name, bc2.`name` ret_company_name, v3.number_plate,v1.* select (CASE v1.lift_company WHEN #{userCompany} THEN 1 ELSE 0 end) liftStatus,(CASE v1.ret_company WHEN #{userCompany} THEN 1 ELSE 0 end) retStatus,bc3.name parkCompanyName,bc4.name subordinateBranchName, conv(v2.booked_date,10,2) book_date, conv(v4.booked_hour,10,2) startHour,conv(v5.booked_hour,10,2) endHour, bc1.`name` lift_company_name, bc2.`name` ret_company_name, v3.number_plate,v1.*
from vehicle_book_record v1 from vehicle_book_record v1
LEFT JOIN vehicle_book_info v2 on v1.vehicle_id = v2.vehicle and v2.year_month = CONCAT(YEAR(v1.book_start_date),"-",IF(MONTH(v1.book_start_date) > 10,MONTH(v1.book_start_date),CONCAT("0",MONTH(v1.book_start_date)))) LEFT JOIN vehicle_book_info v2 on v1.vehicle_id = v2.vehicle and v2.year_month = CONCAT(YEAR(v1.book_start_date),"-",IF(MONTH(v1.book_start_date) > 10,MONTH(v1.book_start_date),CONCAT("0",MONTH(v1.book_start_date))))
LEFT JOIN vehicle_book_hour_info v4 on v4.book_record_id = v1.id and YEAR(v4.year_month_day) = YEAR(v1.book_start_date) AND MONTH(v4.year_month_day) = MONTH(v1.book_start_date) AND DAY(v4.year_month_day) =DAY(v1.book_start_date) LEFT JOIN vehicle_book_hour_info v4 on v4.book_record_id = v1.id and YEAR(v4.year_month_day) = YEAR(v1.book_start_date) AND MONTH(v4.year_month_day) = MONTH(v1.book_start_date) AND DAY(v4.year_month_day) =DAY(v1.book_start_date)
...@@ -442,7 +442,6 @@ ...@@ -442,7 +442,6 @@
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> <foreach collection="companyIds" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</if> </if>
<if test="zoneIds != null"> <if test="zoneIds != null">
and bc1.zone_id in and bc1.zone_id in
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
<select id="selectByBookRecordId" parameterType="java.lang.Integer" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo"> <select id="selectByBookRecordId" parameterType="java.lang.Integer" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo">
select vehicle_departure_log.* select vehicle_departure_log.*
from vehicle_departure_log from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
where vehicle_departure_log.book_record_id = #{id} where vehicle_departure_log.book_record_id = #{id}
order by create_time desc order by create_time desc
</select> </select>
......
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