Commit 7bbb7553 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents 7e50dd22 6369eeb8
...@@ -8,4 +8,4 @@ target/ ...@@ -8,4 +8,4 @@ target/
.classpath .classpath
ace-modules/ace-tool/src/main/resources/application-dev.yml ace-modules/ace-tool/src/main/resources/application-dev.yml
src/main/test/** src/main/test/**
logs/** /logs
...@@ -56,6 +56,15 @@ public class AuthController { ...@@ -56,6 +56,15 @@ public class AuthController {
return new ObjectRestResponse<String>().data(token); return new ObjectRestResponse<String>().data(token);
} }
@RequestMapping(value = "token/small", method = RequestMethod.POST)
public ObjectRestResponse<String> createAuthenticationTokenSmall(
@RequestBody JwtAuthenticationRequest authenticationRequest,
HttpServletRequest request) throws Exception {
log.info(authenticationRequest.getUsername()+" require logging...");
// keliii 分请求类型处理token
return authService.loginSmall(authenticationRequest);
}
@RequestMapping(value = "refresh", method = RequestMethod.GET) @RequestMapping(value = "refresh", method = RequestMethod.GET)
public ObjectRestResponse<String> refreshAndGetAuthenticationToken( public ObjectRestResponse<String> refreshAndGetAuthenticationToken(
HttpServletRequest request) throws Exception { HttpServletRequest request) throws Exception {
......
...@@ -20,6 +20,9 @@ public interface IUserService { ...@@ -20,6 +20,9 @@ public interface IUserService {
@RequestMapping(value = "/api/user/validate", method = RequestMethod.POST) @RequestMapping(value = "/api/user/validate", method = RequestMethod.POST)
public UserInfo validate(@RequestBody JwtAuthenticationRequest authenticationRequest); public UserInfo validate(@RequestBody JwtAuthenticationRequest authenticationRequest);
@RequestMapping(value = "/api/user/validate/small", method = RequestMethod.POST)
public UserInfo validateSmall(@RequestBody JwtAuthenticationRequest authenticationRequest);
@RequestMapping(value = "/api/app/user/validate", method = RequestMethod.POST) @RequestMapping(value = "/api/app/user/validate", method = RequestMethod.POST)
AppUserInfo AppValidate(@RequestBody JwtAuthenticationRequest authenticationRequest); AppUserInfo AppValidate(@RequestBody JwtAuthenticationRequest authenticationRequest);
......
...@@ -3,10 +3,12 @@ package com.github.wxiaoqi.security.auth.service; ...@@ -3,10 +3,12 @@ package com.github.wxiaoqi.security.auth.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest; import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
public interface AuthService { public interface AuthService {
String login(JwtAuthenticationRequest authenticationRequest) throws Exception; String login(JwtAuthenticationRequest authenticationRequest) throws Exception;
ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception;
String refresh(String oldToken) throws Exception; String refresh(String oldToken) throws Exception;
void validate(String token) throws Exception; void validate(String token) throws Exception;
JSONObject sendsms(String username, Integer type) throws Exception; JSONObject sendsms(String username, Integer type) throws Exception;
......
...@@ -2,6 +2,7 @@ package com.github.wxiaoqi.security.auth.service.impl; ...@@ -2,6 +2,7 @@ package com.github.wxiaoqi.security.auth.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.api.vo.user.AppUserInfo; import com.github.wxiaoqi.security.api.vo.user.AppUserInfo;
import com.github.wxiaoqi.security.api.vo.user.UserInfo;
import com.github.wxiaoqi.security.auth.common.util.jwt.JWTInfo; import com.github.wxiaoqi.security.auth.common.util.jwt.JWTInfo;
import com.github.wxiaoqi.security.auth.feign.IUserService; import com.github.wxiaoqi.security.auth.feign.IUserService;
import com.github.wxiaoqi.security.auth.service.AuthService; import com.github.wxiaoqi.security.auth.service.AuthService;
...@@ -9,6 +10,7 @@ import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest; ...@@ -9,6 +10,7 @@ import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtTokenUtil; import com.github.wxiaoqi.security.auth.util.user.JwtTokenUtil;
import com.github.wxiaoqi.security.common.constant.RequestTypeConstants; import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException; import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -36,6 +38,20 @@ public class AppAuthServiceImpl implements AuthService { ...@@ -36,6 +38,20 @@ public class AppAuthServiceImpl implements AuthService {
throw new UserInvalidException("用户不存在或账户密码错误!"); throw new UserInvalidException("用户不存在或账户密码错误!");
} }
@Override
public ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception {
UserInfo info = userService.validateSmall(authenticationRequest);
if (info!=null&&!StringUtils.isEmpty(info.getId())) {
info.setPassword(null);
JSONObject object=new JSONObject();
String token=jwtTokenUtil.generateToken(new JWTInfo(info.getUsername(), info.getId() + "", info.getName()));
object.put("token",token);
object.put("info",info);
return ObjectRestResponse.succ(object);
}
throw new UserInvalidException("用户不存在或账户密码错误!");
}
@Override @Override
public String refresh(String oldToken) throws Exception { public String refresh(String oldToken) throws Exception {
return jwtTokenUtil.generateToken(jwtTokenUtil.getInfoFromToken(oldToken)); return jwtTokenUtil.generateToken(jwtTokenUtil.getInfoFromToken(oldToken));
......
...@@ -9,6 +9,7 @@ import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest; ...@@ -9,6 +9,7 @@ import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.auth.util.user.JwtTokenUtil; import com.github.wxiaoqi.security.auth.util.user.JwtTokenUtil;
import com.github.wxiaoqi.security.common.constant.RequestTypeConstants; import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException; import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -36,6 +37,20 @@ public class AuthServiceImpl implements AuthService { ...@@ -36,6 +37,20 @@ public class AuthServiceImpl implements AuthService {
throw new UserInvalidException("用户不存在或账户密码错误!"); throw new UserInvalidException("用户不存在或账户密码错误!");
} }
@Override
public ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception {
UserInfo info = userService.validateSmall(authenticationRequest);
if (info!=null&&!StringUtils.isEmpty(info.getId())) {
info.setPassword(null);
JSONObject object=new JSONObject();
String token=jwtTokenUtil.generateToken(new JWTInfo(info.getUsername(), info.getId() + "", info.getName()));
object.put("token",token);
object.put("info",info);
return ObjectRestResponse.succ(object);
}
throw new UserInvalidException("用户不存在或账户密码错误!");
}
@Override @Override
public void validate(String token) throws Exception { public void validate(String token) throws Exception {
jwtTokenUtil.getInfoFromToken(token); jwtTokenUtil.getInfoFromToken(token);
......
...@@ -40,6 +40,11 @@ public class UserRest { ...@@ -40,6 +40,11 @@ public class UserRest {
public @ResponseBody UserInfo validate(@RequestBody Map<String,String> body){ public @ResponseBody UserInfo validate(@RequestBody Map<String,String> body){
return permissionService.validate(body.get("username"),body.get("password")); return permissionService.validate(body.get("username"),body.get("password"));
} }
@RequestMapping(value = "/user/validate/small", method = RequestMethod.POST)
public @ResponseBody UserInfo validateSmall(@RequestBody Map<String,String> body){
return permissionService.validateSmall(body.get("username"),body.get("password"));
}
......
...@@ -14,6 +14,8 @@ import com.github.wxiaoqi.security.api.vo.user.UserInfo; ...@@ -14,6 +14,8 @@ import com.github.wxiaoqi.security.api.vo.user.UserInfo;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil; import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.common.constant.CommonConstants; import com.github.wxiaoqi.security.common.constant.CommonConstants;
import com.github.wxiaoqi.security.common.util.TreeUtil; import com.github.wxiaoqi.security.common.util.TreeUtil;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -38,6 +40,9 @@ public class PermissionService { ...@@ -38,6 +40,9 @@ public class PermissionService {
private ElementBiz elementBiz; private ElementBiz elementBiz;
@Autowired @Autowired
private UserAuthUtil userAuthUtil; private UserAuthUtil userAuthUtil;
@Autowired
private VehicleFeign vehicleFeign;
private BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12); private BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12);
...@@ -60,6 +65,22 @@ public class PermissionService { ...@@ -60,6 +65,22 @@ public class PermissionService {
} }
return info; return info;
} }
//小程序登录
public UserInfo validateSmall(String username,String password){
UserInfo info = new UserInfo();
User user = userBiz.getUserByUsername(username);
if (user!=null){
if (encoder.matches(password, user.getPassword())) {
BeanUtils.copyProperties(user, info);
info.setId(user.getId().toString());
List<BranchCompany> list=vehicleFeign.companyAll(2,user.getDataCompany(),null);
if (list.size()>0){
info.setDataCompanyName(list.get(0).getName());
}
}
}
return info;
}
public List<PermissionInfo> getAllPermission() { public List<PermissionInfo> getAllPermission() {
List<Menu> menus = menuBiz.selectListAll(); List<Menu> menus = menuBiz.selectListAll();
......
...@@ -18,6 +18,7 @@ public class UserInfo implements Serializable{ ...@@ -18,6 +18,7 @@ public class UserInfo implements Serializable{
private Integer dataAll; private Integer dataAll;
private String dataZone; private String dataZone;
private String dataCompany; private String dataCompany;
private String dataCompanyName;
public Date getUpdTime() { public Date getUpdTime() {
return updTime; return updTime;
...@@ -92,4 +93,13 @@ public class UserInfo implements Serializable{ ...@@ -92,4 +93,13 @@ public class UserInfo implements Serializable{
public void setDataCompany(String dataCompany) { public void setDataCompany(String dataCompany) {
this.dataCompany = dataCompany; this.dataCompany = dataCompany;
} }
public String getDataCompanyName() {
return dataCompanyName;
}
public void setDataCompanyName(String dataCompanyName) {
this.dataCompanyName = dataCompanyName;
}
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -370,8 +370,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -370,8 +370,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
} }
} }
public DailyOrderStatistics getTotalOrder() { public boolean getTotalOrder() {
return mapper.getTotalOrder();
mapper.getTotalOrder();
return false;
} }
// @Scheduled(cron = "0 0 2 * * ? ") // @Scheduled(cron = "0 0 2 * * ? ")
......
...@@ -24,7 +24,7 @@ public class BaseOrderStatisticsJobHandler extends IJobHandler { ...@@ -24,7 +24,7 @@ public class BaseOrderStatisticsJobHandler extends IJobHandler {
@Override @Override
public ReturnT<String> execute(String s) throws Exception { public ReturnT<String> execute(String s) throws Exception {
try { try {
DailyOrderStatistics dailyOrderStatistics= baseOrderBiz.getTotalOrder(); baseOrderBiz.getTotalOrder();
ReturnT returnT = new ReturnT(){{ ReturnT returnT = new ReturnT(){{
setCode(100); setCode(100);
......
...@@ -41,6 +41,7 @@ public class CertificationController { ...@@ -41,6 +41,7 @@ public class CertificationController {
private UserFeign userFeign; private UserFeign userFeign;
@Qualifier("applicationTaskExecutor") @Qualifier("applicationTaskExecutor")
@Autowired @Autowired
private TaskExecutor executor; private TaskExecutor executor;
...@@ -102,12 +103,13 @@ public class CertificationController { ...@@ -102,12 +103,13 @@ public class CertificationController {
if (type!=null&&type==0){ if (type!=null&&type==0){
ObjectRestResponse<Integer> result = certificationService.certificate(idInformation); ObjectRestResponse<Integer> result = certificationService.certificate(idInformation);
if (result.getRel()) { if (result.getRel()) {
executor.execute(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
setIntegral(appUserDTO.getUserid(),result.getData()); setIntegral(appUserDTO.getUserid(),result.getData());
} }
}); });
thread.start();
} }
return result ; return result ;
} }
......
...@@ -36,8 +36,6 @@ public class TrafficViolationsService { ...@@ -36,8 +36,6 @@ public class TrafficViolationsService {
@Autowired @Autowired
private LicensePlateTypeBiz licensePlateTypeBiz; private LicensePlateTypeBiz licensePlateTypeBiz;
@Autowired
private TaskExecutor taskExecutor;
@Value("${ALIYUN.CODE}") @Value("${ALIYUN.CODE}")
private String CODE; private String CODE;
...@@ -191,12 +189,15 @@ public class TrafficViolationsService { ...@@ -191,12 +189,15 @@ public class TrafficViolationsService {
licensePlateTypes = saveLicensePlateType(); licensePlateTypes = saveLicensePlateType();
List<LicensePlateType> finalLicensePlateTypes = licensePlateTypes; List<LicensePlateType> finalLicensePlateTypes = licensePlateTypes;
taskExecutor.execute(new Runnable() {
Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
insertLicensePlateType(finalLicensePlateTypes); insertLicensePlateType(finalLicensePlateTypes);
} }
}); } );
thread.start();
} }
return licensePlateTypes; return licensePlateTypes;
} }
......
...@@ -86,4 +86,8 @@ public class VehicleDepartureLog { ...@@ -86,4 +86,8 @@ public class VehicleDepartureLog {
* 预约记录id * 预约记录id
*/ */
Integer bookRecordId; Integer bookRecordId;
String illegalPic;
Integer illegalAmount;
} }
package com.xxfc.platform.vehicle.pojo; package com.xxfc.platform.vehicle.pojo;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class VehicleBookRecordQueryVo { public class VehicleBookRecordQueryVo extends PageParam {
/** /**
* 车辆编号,0-没有 * 车辆编号,0-没有
...@@ -38,19 +41,16 @@ public class VehicleBookRecordQueryVo { ...@@ -38,19 +41,16 @@ public class VehicleBookRecordQueryVo {
*/ */
private Integer retCompany; private Integer retCompany;
private Integer page;
private Integer limit;
/** /**
* 预定类型 * 预定类型
*/ */
private Integer bookType; private Integer bookType;
private Integer zoneId; private Integer zoneId;
private Integer companyId;
private List<String> zoneIds;
private String[] zoneIds; private List<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;
} }
...@@ -26,4 +26,9 @@ public class VehicleDepartureLogVo { ...@@ -26,4 +26,9 @@ public class VehicleDepartureLogVo {
String departureDay; String departureDay;
String departureName; String departureName;
String arrivalName; String arrivalName;
Integer bookRecordId;
String illegalPic;
Integer illegalAmount;
} }
package com.xxfc.platform.vehicle.biz; package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -404,7 +405,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -404,7 +405,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()){
...@@ -418,21 +419,12 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -418,21 +419,12 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
VehicleBookRecord vehicleBookRecord = null; VehicleBookRecord vehicleBookRecord = null;
if(bookVehicleVo.getVehicleBookRecordId() == null) { if(bookVehicleVo.getVehicleBookRecordId() == null) {
vehicleBookRecord = new VehicleBookRecord(); vehicleBookRecord = new VehicleBookRecord();
vehicleBookRecord.setVehicleId(bookVehicleVo.getVehicleId()); BeanUtil.copyProperties(bookVehicleVo, vehicleBookRecord, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
vehicleBookRecord.setBookType(bookVehicleVo.getBookType()); vehicleBookRecord.setBookStartDate(startDay.toDate());
vehicleBookRecord.setBookEndDate(endDay.toDate());
vehicleBookRecord.setStatus(VehicleBookRecordStatus.APPLY.getCode()); vehicleBookRecord.setStatus(VehicleBookRecordStatus.APPLY.getCode());
vehicleBookRecord.setBookUser(userId); vehicleBookRecord.setBookUser(userId);
vehicleBookRecord.setBookUserName(userName); vehicleBookRecord.setBookUserName(userName);
vehicleBookRecord.setBookStartDate(startDay.toDate());
vehicleBookRecord.setBookEndDate(endDay.toDate());
vehicleBookRecord.setLiftAddr(bookVehicleVo.getLiftAddr());
vehicleBookRecord.setRemark(bookVehicleVo.getRemark());
vehicleBookRecord.setDestination(bookVehicleVo.getDestination());
vehicleBookRecord.setLiftCompany(bookVehicleVo.getLiftCompany());
vehicleBookRecord.setRetCompany(bookVehicleVo.getRetCompany());
vehicleBookRecord.setVehicleUsername(bookVehicleVo.getVehicleUsername());
vehicleBookRecord.setVehicleUserPhone(bookVehicleVo.getVehicleUserPhone());
vehicleBookRecord.setUpkeepIds(bookVehicleVo.getUpkeepIds());
vehicleBookRecordBiz.save(vehicleBookRecord); vehicleBookRecordBiz.save(vehicleBookRecord);
} else { } else {
vehicleBookRecord = vehicleBookRecordBiz.selectById(bookVehicleVo.getVehicleBookRecordId()); vehicleBookRecord = vehicleBookRecordBiz.selectById(bookVehicleVo.getVehicleBookRecordId());
...@@ -497,7 +489,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -497,7 +489,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()){
...@@ -511,21 +503,12 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -511,21 +503,12 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
VehicleBookRecord vehicleBookRecord = null; VehicleBookRecord vehicleBookRecord = null;
if(bookVehicleVo.getVehicleBookRecordId() == null) { if(bookVehicleVo.getVehicleBookRecordId() == null) {
vehicleBookRecord = new VehicleBookRecord(); vehicleBookRecord = new VehicleBookRecord();
vehicleBookRecord.setVehicleId(bookVehicleVo.getVehicleId()); BeanUtil.copyProperties(bookVehicleVo, vehicleBookRecord, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
vehicleBookRecord.setBookType(bookVehicleVo.getBookType()); vehicleBookRecord.setBookStartDate(startDay.toDate());
vehicleBookRecord.setBookEndDate(endDay.toDate());
vehicleBookRecord.setStatus(VehicleBookRecordStatus.APPROVE.getCode()); vehicleBookRecord.setStatus(VehicleBookRecordStatus.APPROVE.getCode());
vehicleBookRecord.setBookUser(userId); vehicleBookRecord.setBookUser(userId);
vehicleBookRecord.setBookUserName(userName); vehicleBookRecord.setBookUserName(userName);
vehicleBookRecord.setBookStartDate(startDay.toDate());
vehicleBookRecord.setBookEndDate(endDay.toDate());
vehicleBookRecord.setLiftAddr(bookVehicleVo.getLiftAddr());
vehicleBookRecord.setRemark(bookVehicleVo.getRemark());
vehicleBookRecord.setDestination(bookVehicleVo.getDestination());
vehicleBookRecord.setLiftCompany(bookVehicleVo.getLiftCompany());
vehicleBookRecord.setRetCompany(bookVehicleVo.getRetCompany());
vehicleBookRecord.setVehicleUsername(bookVehicleVo.getVehicleUsername());
vehicleBookRecord.setVehicleUserPhone(bookVehicleVo.getVehicleUserPhone());
vehicleBookRecord.setUpkeepIds(bookVehicleVo.getUpkeepIds());
vehicleBookRecordBiz.save(vehicleBookRecord); vehicleBookRecordBiz.save(vehicleBookRecord);
} else { } else {
vehicleBookRecord = vehicleBookRecordBiz.selectById(bookVehicleVo.getVehicleBookRecordId()); vehicleBookRecord = vehicleBookRecordBiz.selectById(bookVehicleVo.getVehicleBookRecordId());
...@@ -747,7 +730,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -747,7 +730,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 +809,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -826,7 +809,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 +820,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -837,7 +820,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 +839,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -856,7 +839,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 +860,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -877,7 +860,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 +887,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -904,7 +887,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 +932,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -949,7 +932,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的整形值
...@@ -1291,22 +1274,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -1291,22 +1274,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
if(DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据 if(DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据
String zoneId = null; String zoneId = null;
if(StringUtils.isNotBlank(userDTO.getDataZone())) { if(StringUtils.isNotBlank(userDTO.getDataZone())) {
if(userDTO.getDataZone().contains(",")) {
zoneId = userDTO.getDataZone(); zoneId = userDTO.getDataZone();
} else {
zoneId = userDTO.getDataZone() + ",";
}
} else { } else {
zoneId = userDTO.getZoneId() + ","; zoneId = userDTO.getZoneId() + ",";
} }
vehiclePlanDto.setZoneIds(zoneId.split(",")); vehiclePlanDto.setZoneIds(zoneId.split(","));
String companyId = null; String companyId = null;
if(StringUtils.isNotBlank(userDTO.getDataCompany())) { if(StringUtils.isNotBlank(userDTO.getDataCompany())) {
if(userDTO.getDataCompany().contains(",")) {
companyId = userDTO.getDataCompany(); companyId = userDTO.getDataCompany();
} else {
companyId = userDTO.getDataCompany() + ",";
}
} else { } else {
companyId = userDTO.getCompanyId() + ","; companyId = userDTO.getCompanyId() + ",";
} }
......
...@@ -37,6 +37,8 @@ import org.springframework.stereotype.Service; ...@@ -37,6 +37,8 @@ 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 java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -93,10 +95,13 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -93,10 +95,13 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
public RestResponse<PageDataVO> getBookRecord(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) { public RestResponse<PageDataVO> getBookRecord(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) {
Integer pageNo = vehicleBookRecordQueryVo.getPage() == null ? 1 : vehicleBookRecordQueryVo.getPage(); Integer pageNo = vehicleBookRecordQueryVo.getPage() == null ? 1 : vehicleBookRecordQueryVo.getPage();
Integer pageSize = vehicleBookRecordQueryVo.getLimit() == null ? 10 : vehicleBookRecordQueryVo.getLimit(); Integer pageSize = vehicleBookRecordQueryVo.getLimit() == null ? 10 : vehicleBookRecordQueryVo.getLimit();
vehicleBookRecordQueryVo.setPage(pageNo);
vehicleBookRecordQueryVo.setLimit(pageSize);
UserDTO userDTO = adminInfoFeign.getAdminUserInfo(); UserDTO userDTO = adminInfoFeign.getAdminUserInfo();
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;
...@@ -109,7 +114,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -109,7 +114,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} else { } else {
zoneId = userDTO.getZoneId() + ","; zoneId = userDTO.getZoneId() + ",";
} }
vehicleBookRecordQueryVo.setZoneIds(zoneId.split(",")); vehicleBookRecordQueryVo.setZoneIds(Arrays.asList(zoneId.split(",")));
String companyId = null; String companyId = null;
if(StringUtils.isNotBlank(userDTO.getDataCompany())) { if(StringUtils.isNotBlank(userDTO.getDataCompany())) {
if(userDTO.getDataCompany().contains(",")) { if(userDTO.getDataCompany().contains(",")) {
...@@ -120,23 +125,29 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -120,23 +125,29 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} else { } else {
companyId = userDTO.getCompanyId() + ","; companyId = userDTO.getCompanyId() + ",";
} }
vehicleBookRecordQueryVo.setCompanyIds(companyId.split(",")); vehicleBookRecordQueryVo.setCompanyIds(Arrays.asList(companyId.split(",")));
} }
} else {
vehicleBookRecordQueryVo.setZoneIds(Arrays.asList((vehicleBookRecordQueryVo.getZoneId() + ",").split(",")));
vehicleBookRecordQueryVo.setCompanyIds(Arrays.asList((vehicleBookRecordQueryVo.getLiftCompany() + ",").split(",")));
} }
List<VehicleBookRecordVo> list = mapper.getBookRecord(vehicleBookRecordQueryVo); vehicleBookRecordQueryVo.getCompanyIds().add(vehicleBookRecordQueryVo.getCompanyId() + "");
PageHelper.startPage(pageNo,pageSize); Query query = new Query(vehicleBookRecordQueryVo);
PageInfo<VehicleBookRecordVo> vehiclePageInfo = new PageInfo<>(list); PageDataVO<VehicleBookRecordVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getBookRecordInfo(query.getSuper()));
return RestResponse.suc(PageDataVO.pageInfo(vehiclePageInfo)); return RestResponse.suc(pageDataVO);
} }
public RestResponse<PageDataVO> getBookRecordInfo(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) { public RestResponse<PageDataVO> getBookRecordInfo(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) {
Integer pageNo = vehicleBookRecordQueryVo.getPage() == null ? 1 : vehicleBookRecordQueryVo.getPage(); Integer pageNo = vehicleBookRecordQueryVo.getPage() == null ? 1 : vehicleBookRecordQueryVo.getPage();
Integer pageSize = vehicleBookRecordQueryVo.getLimit() == null ? 10 : vehicleBookRecordQueryVo.getLimit(); Integer pageSize = vehicleBookRecordQueryVo.getLimit() == null ? 10 : vehicleBookRecordQueryVo.getLimit();
vehicleBookRecordQueryVo.setPage(pageNo);
vehicleBookRecordQueryVo.setLimit(pageSize);
UserDTO userDTO = adminInfoFeign.getAdminUserInfo(); UserDTO userDTO = adminInfoFeign.getAdminUserInfo();
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;
...@@ -149,7 +160,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -149,7 +160,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} else { } else {
zoneId = userDTO.getZoneId() + ","; zoneId = userDTO.getZoneId() + ",";
} }
vehicleBookRecordQueryVo.setZoneIds(zoneId.split(",")); vehicleBookRecordQueryVo.setZoneIds(Arrays.asList(zoneId.split(",")));
String companyId = null; String companyId = null;
if(StringUtils.isNotBlank(userDTO.getDataCompany())) { if(StringUtils.isNotBlank(userDTO.getDataCompany())) {
if(userDTO.getDataCompany().contains(",")) { if(userDTO.getDataCompany().contains(",")) {
...@@ -160,13 +171,21 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -160,13 +171,21 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} else { } else {
companyId = userDTO.getCompanyId() + ","; companyId = userDTO.getCompanyId() + ",";
} }
vehicleBookRecordQueryVo.setCompanyIds(companyId.split(",")); vehicleBookRecordQueryVo.setCompanyIds(Arrays.asList(companyId.split(",")));
} }
} else {
vehicleBookRecordQueryVo.setZoneIds(Arrays.asList((vehicleBookRecordQueryVo.getZoneId() + ",").split(",")));
vehicleBookRecordQueryVo.setCompanyIds(Arrays.asList((vehicleBookRecordQueryVo.getLiftCompany() + ",").split(",")));
} }
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(vehicleBookRecordQueryVo); if(vehicleBookRecordQueryVo.getCompanyId() != null) {
PageHelper.startPage(pageNo,pageSize); if(vehicleBookRecordQueryVo.getCompanyIds() == null) {
PageInfo<VehicleBookRecordVo> vehiclePageInfo = new PageInfo<>(list); vehicleBookRecordQueryVo.setCompanyIds(new ArrayList<>());
return RestResponse.suc(PageDataVO.pageInfo(vehiclePageInfo)); }
vehicleBookRecordQueryVo.getCompanyIds().add(vehicleBookRecordQueryVo.getCompanyId() + "");
}
Query query = new Query(vehicleBookRecordQueryVo);
PageDataVO<VehicleBookRecordVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getBookRecordInfo(query.getSuper()));
return RestResponse.suc(pageDataVO);
} }
public RestResponse<Integer> lift(Integer operatorId, String userName, LiftVehicleVo liftVehicleVo) throws Exception{ public RestResponse<Integer> lift(Integer operatorId, String userName, LiftVehicleVo liftVehicleVo) throws Exception{
......
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;
...@@ -13,6 +14,7 @@ import com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper; ...@@ -13,6 +14,7 @@ import com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper;
import com.xxfc.platform.vehicle.mapper.VehicleMapper; import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo; import com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureStatisticDataVo; import com.xxfc.platform.vehicle.pojo.VehicleDepartureStatisticDataVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -24,17 +26,15 @@ import java.util.Date; ...@@ -24,17 +26,15 @@ import java.util.Date;
import java.util.List; import java.util.List;
@Service @Service
@Slf4j
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 +42,12 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, ...@@ -42,12 +42,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,29 +61,42 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, ...@@ -61,29 +61,42 @@ 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();
log.info("添加出行记录参数: vehicleDepartureLog = {}", vehicleDepartureLog);
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);
return ObjectRestResponse.succ();
} else { } else {
vehicleDepartureLog.setUpdateTime(new Date()); vehicleDepartureLog.setUpdateTime(new Date());
updateSelectiveById(vehicleDepartureLog); VehicleDepartureLog oldValue = mapper.selectByPrimaryKey(vehicleDepartureLog);
if(oldValue != null) {
log.info("更新出行记录: vehicleDepartureLog = {}", oldValue);
BeanUtil.copyProperties(vehicleDepartureLog, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
oldValue.setUpdateTime(new Date());
updateSelectiveById(oldValue);
return ObjectRestResponse.succ();
} else {
vehicleDepartureLog.setCreateTime(new Date());
vehicleDepartureLog.setState(0);
insertSelective(vehicleDepartureLog);
return ObjectRestResponse.succ();
}
} }
return ObjectRestResponse.succ();
} }
......
...@@ -34,5 +34,5 @@ public interface VehicleBookRecordMapper extends Mapper<VehicleBookRecord> { ...@@ -34,5 +34,5 @@ public interface VehicleBookRecordMapper extends Mapper<VehicleBookRecord> {
public List<VehicleBookRecordVo> getBookRecord(VehicleBookRecordQueryVo vehicleBookRecordQueryVo); public List<VehicleBookRecordVo> getBookRecord(VehicleBookRecordQueryVo vehicleBookRecordQueryVo);
public List<VehicleBookRecordVo> getBookRecordInfo(VehicleBookRecordQueryVo vehicleBookRecordQueryVo); public List<VehicleBookRecordVo> getBookRecordInfo(Map<String, Object> param);
} }
\ No newline at end of file
...@@ -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);
} }
......
...@@ -416,12 +416,9 @@ ...@@ -416,12 +416,9 @@
</select> </select>
<select id="getBookRecordInfo" resultMap="searchBookRecord" parameterType="com.xxfc.platform.vehicle.pojo.VehicleBookRecordQueryVo"> <select id="getBookRecordInfo" resultMap="searchBookRecord" parameterType="java.util.Map">
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,bc4.name subordinateBranchName, 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_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 v5 on v5.book_record_id = v1.id and YEAR(v5.year_month_day) = YEAR(v1.book_end_date) AND MONTH(v5.year_month_day) = MONTH(v1.book_end_date) AND DAY(v5.year_month_day) =DAY(v1.book_end_date)
LEFT JOIN branch_company bc1 ON v1.lift_company = bc1.id LEFT JOIN branch_company bc1 ON v1.lift_company = bc1.id
LEFT JOIN branch_company bc2 on v1.ret_company = bc2.id LEFT JOIN branch_company bc2 on v1.ret_company = bc2.id
LEFT JOIN vehicle v3 on v3.id = v1.vehicle_id LEFT JOIN vehicle v3 on v3.id = v1.vehicle_id
...@@ -429,7 +426,7 @@ ...@@ -429,7 +426,7 @@
LEFT JOIN branch_company bc4 on v3.subordinate_branch = bc4.id LEFT JOIN branch_company bc4 on v3.subordinate_branch = bc4.id
<where> <where>
<if test="selectedMonth != null"> <if test="selectedMonth != null">
and v2.year_month = #{selectedMonth} and (v1.book_start_date like CONCAT(#{selectedMonth}, "%") or v1.book_start_date like CONCAT(#{selectedMonth}, "%"))
</if> </if>
<if test="numberPlate != null"> <if test="numberPlate != null">
and v3.number_plate = #{numberPlate} and v3.number_plate = #{numberPlate}
...@@ -438,11 +435,14 @@ ...@@ -438,11 +435,14 @@
and v1.book_type = #{bookType} and v1.book_type = #{bookType}
</if> </if>
<if test="companyIds != null"> <if test="companyIds != null">
and v1.lift_company in and (v1.lift_company in
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> <foreach collection="companyIds" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
or v1.ret_company in
<foreach collection="companyIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>)
</if> </if>
<if test="zoneIds != null"> <if test="zoneIds != null">
and bc1.zone_id in and bc1.zone_id in
...@@ -454,6 +454,7 @@ ...@@ -454,6 +454,7 @@
and v1.status = #{status} and v1.status = #{status}
</if> </if>
</where> </where>
group by v1.id
order by create_time DESC order by create_time DESC
</select> </select>
......
...@@ -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>
......
...@@ -457,7 +457,7 @@ ...@@ -457,7 +457,7 @@
</select> </select>
<select id="getVehicle" resultMap="vehicleModel" parameterType="java.util.Map"> <select id="getVehicle" resultMap="vehicleModel" parameterType="java.util.Map">
select v1.* from vehicle v1 select v1.*,bc3.name parkCompanyName from vehicle v1
LEFT JOIN branch_company bc3 ON v1.park_branch_company_id = bc3.id LEFT JOIN branch_company bc3 ON v1.park_branch_company_id = bc3.id
<where> <where>
<if test="numberPlate != null"> <if test="numberPlate != null">
...@@ -468,7 +468,6 @@ ...@@ -468,7 +468,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 bc3.zone_id in and bc3.zone_id in
......
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