Commit 9aeb7a18 authored by hezhen's avatar hezhen

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

parents f6dd399c 3335f12b
......@@ -7,4 +7,5 @@ target/
.settings/
.classpath
ace-modules/ace-tool/src/main/resources/application-dev.yml
src/main/test/**
\ No newline at end of file
src/main/test/**
logs/**
......@@ -14,6 +14,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.entity.SysRegion;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import javafx.print.Collation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.collections.CollectionUtils;
......@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
* @author Administrator
*/
@Service
@Slf4j
public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail> {
@Autowired
......@@ -74,7 +76,7 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
List<Integer> citysCode = pageInfo.getList().parallelStream().map(AppUserManageVo::getCityCode).collect(Collectors.toList());
HashSet<Integer> set = new HashSet<>();
set.addAll(citysCode);
ObjectRestResponse<List<SysRegion>> orr = vehicleFeign.getSysRegionByIds(set);
ObjectRestResponse<List<SysRegion>> orr = vehicleFeign.getSysRegion(set);
List<SysRegion> sysRegions = orr.getData();
if (CollectionUtils.isNotEmpty(sysRegions)) {
HashMap<Long, String> map = new HashMap<>();
......@@ -82,7 +84,9 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
map.put(sysRegion.getId(),sysRegion.getName());
}
for (AppUserManageVo appUserManageVo : pageInfo.getList()) {
appUserManageVo.setCityName(map.get(appUserManageVo.getCityCode()));
Long cityCode = Long.valueOf(appUserManageVo.getCityCode());
String crtyName = map.get(cityCode);
appUserManageVo.setCityName(crtyName);
}
}
return pageInfo;
......
......@@ -65,7 +65,6 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
}
@DeleteMapping("/manage/delMembershipGrade/{id}")
public ObjectRestResponse delMembershipGrade(@PathVariable Integer id){
BaseUserMemberLevel baseUserMemberLevel = new BaseUserMemberLevel();
......
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> {
}
}
public DailyOrderStatistics getTotalOrder() {
return mapper.getTotalOrder();
public boolean getTotalOrder() {
mapper.getTotalOrder();
return false;
}
// @Scheduled(cron = "0 0 2 * * ? ")
......
......@@ -24,7 +24,7 @@ public class BaseOrderStatisticsJobHandler extends IJobHandler {
@Override
public ReturnT<String> execute(String s) throws Exception {
try {
DailyOrderStatistics dailyOrderStatistics= baseOrderBiz.getTotalOrder();
baseOrderBiz.getTotalOrder();
ReturnT returnT = new ReturnT(){{
setCode(100);
......
......@@ -41,6 +41,7 @@ public class CertificationController {
private UserFeign userFeign;
@Qualifier("applicationTaskExecutor")
@Autowired
private TaskExecutor executor;
......@@ -102,12 +103,13 @@ public class CertificationController {
if (type!=null&&type==0){
ObjectRestResponse<Integer> result = certificationService.certificate(idInformation);
if (result.getRel()) {
executor.execute(new Runnable() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
setIntegral(appUserDTO.getUserid(),result.getData());
}
});
thread.start();
}
return result ;
}
......
......@@ -36,8 +36,6 @@ public class TrafficViolationsService {
@Autowired
private LicensePlateTypeBiz licensePlateTypeBiz;
@Autowired
private TaskExecutor taskExecutor;
@Value("${ALIYUN.CODE}")
private String CODE;
......@@ -191,12 +189,15 @@ public class TrafficViolationsService {
licensePlateTypes = saveLicensePlateType();
List<LicensePlateType> finalLicensePlateTypes = licensePlateTypes;
taskExecutor.execute(new Runnable() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
insertLicensePlateType(finalLicensePlateTypes);
insertLicensePlateType(finalLicensePlateTypes);
}
});
} );
thread.start();
}
return licensePlateTypes;
}
......
......@@ -86,4 +86,8 @@ public class VehicleDepartureLog {
* 预约记录id
*/
Integer bookRecordId;
private String illegalPic;
private Integer illegalAmount;
}
......@@ -87,11 +87,11 @@ public interface VehicleFeign {
RestResponse getSysRegionById(@PathVariable(value = "id") Integer id);
/**
* 多个城市code获取城市代码
* @param ids
* @param idSet
* @return
*/
@PostMapping("/sysRegion/getSysRegionByIds")
ObjectRestResponse<List<SysRegion>> getSysRegionByIds(@RequestBody Set<Integer> ids);
@PostMapping("/sysRegion/getSysRegion")
ObjectRestResponse<List<SysRegion>> getSysRegion(Set<Integer> idSet);
/**
* 获取公司所在的城市
......
......@@ -53,4 +53,5 @@ public class VehicleBookRecordQueryVo {
private String[] companyIds;
private String upkeepIds;
private Integer userCompany;
}
\ No newline at end of file
......@@ -28,4 +28,8 @@ public class VehicleBookRecordVo extends VehicleBookRecord {
private VehicleDepartureLogVo vehicleDepartureLogVo;
private String numberPlate;
private Integer liftStatus;
private Integer retStatus;
}
......@@ -38,11 +38,7 @@ import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......@@ -332,6 +328,9 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
*/
public Set<Integer> getCity(String zoneList, String companyList) {
List<Integer> list = vehicleBiz.dataCompany(zoneList, companyList);
if (CollectionUtils.isEmpty(list)) {
return new HashSet<>();
}
Example exa =new Example(BranchCompany.class);
Example.Criteria criteria = exa.createCriteria();
criteria.andIn("id",list);
......
......@@ -382,8 +382,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
return vehicleBookRecord;
}
/**
* 需要审核
* @param userId
* @param bookVehicleVo
* @param userName
* @return
* @throws Exception
*/
@Transactional
public VehicleBookRecord applyVehicle(Integer userId, BookVehicleVO bookVehicleVo, String userName) throws Exception{
public VehicleBookRecord applyForVehicle(Integer userId, BookVehicleVO bookVehicleVo, String userName) throws Exception{
log.info("预定车辆参数:userId = {}, bookVehicleVo = {},username = {}", userId, bookVehicleVo, userName);
//检查车辆信息是否合法
checkIfVehicleExists(bookVehicleVo.getVehicleId());
......@@ -396,7 +404,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
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()){
......@@ -412,7 +420,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
vehicleBookRecord = new VehicleBookRecord();
vehicleBookRecord.setVehicleId(bookVehicleVo.getVehicleId());
vehicleBookRecord.setBookType(bookVehicleVo.getBookType());
vehicleBookRecord.setStatus(VehicleBookRecordStatus.APPROVE.getCode());
vehicleBookRecord.setStatus(VehicleBookRecordStatus.APPLY.getCode());
vehicleBookRecord.setBookUser(userId);
vehicleBookRecord.setBookUserName(userName);
vehicleBookRecord.setBookStartDate(startDay.toDate());
......@@ -467,6 +475,98 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
return vehicleBookRecord;
}
/**
* 不需要审核
* @param userId
* @param bookVehicleVo
* @param userName
* @return
* @throws Exception
*/
@Transactional
public VehicleBookRecord applyVehicle(Integer userId, BookVehicleVO bookVehicleVo, String userName) throws Exception{
log.info("预定车辆参数:userId = {}, bookVehicleVo = {},username = {}", userId, bookVehicleVo, userName);
//检查车辆信息是否合法
checkIfVehicleExists(bookVehicleVo.getVehicleId());
//提取日期和相应的预定目标日期
Map<String,List<String>> yearMonthAndDate = Maps.newHashMap();
DateTime startDay =DateTime.parse(bookVehicleVo.getBookStartDate(),DATE_TIME_FORMATTER);
DateTime endDay =DateTime.parse(bookVehicleVo.getBookEndDate(), DATE_TIME_FORMATTER);
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
}
//检查车辆是否可以预定
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
Boolean rsEach = applyVehicle4EmployeePerMonth(bookVehicleVo.getVehicleId(),entry.getValue(),entry.getKey());
if(Boolean.FALSE.equals(rsEach)){
throw new BaseException(ResultCode.FAILED_CODE);
}
}
//加入预定申请记录
VehicleBookRecord vehicleBookRecord = null;
if(bookVehicleVo.getVehicleBookRecordId() == null) {
vehicleBookRecord = new VehicleBookRecord();
vehicleBookRecord.setVehicleId(bookVehicleVo.getVehicleId());
vehicleBookRecord.setBookType(bookVehicleVo.getBookType());
vehicleBookRecord.setStatus(VehicleBookRecordStatus.APPROVE.getCode());
vehicleBookRecord.setBookUser(userId);
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);
} else {
vehicleBookRecord = vehicleBookRecordBiz.selectById(bookVehicleVo.getVehicleBookRecordId());
vehicleBookRecord.setBookStartDate(startDay.toDate());
vehicleBookRecord.setBookEndDate(endDay.toDate());
vehicleBookRecordBiz.updateSelectiveByIdRe(vehicleBookRecord);
}
// //添加预定时间记录
VehicleBookRecord newValue = vehicleBookRecordBiz.selectOne(vehicleBookRecord);
Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getBookStartDate(), bookVehicleVo.getBookEndDate());
for(Map.Entry<String, Integer> entry : map.entrySet()) {
VehicleBookHourInfoDto vehicleBookHourInfoDto = new VehicleBookHourInfoDto();
vehicleBookHourInfoDto.setVehicleId(bookVehicleVo.getVehicleId());
vehicleBookHourInfoDto.setYearMonthDay(entry.getKey());
vehicleBookHourInfoDto.setBookedHour(entry.getValue());
vehicleBookHourInfoDto.setBookRecordId(newValue.getId());
vehicleBookHourInfoBiz.save(vehicleBookHourInfoDto);
}
//修改相关车辆预定记录
Boolean hasSuc = bookedVehicle(bookVehicleVo);
if(!hasSuc){
throw new BaseException(ResultCode.FAILED_CODE);
}
//添加随车物品
List<Map<String,Object>> params = Lists.newArrayList();
if(MapUtils.isNotEmpty(bookVehicleVo.getSelectedAccItem())){
for(Map.Entry<Integer,Integer> idAndAmount : bookVehicleVo.getSelectedAccItem().entrySet()){
Map<String,Object> row = Maps.newHashMap();
row.put("id",idAndAmount.getKey());
row.put("amount",idAndAmount.getValue());
row.put("bookRecordId",vehicleBookRecord.getId());
params.add(row);
}
bookRecordAccItemMapper.batchAdd(params);
}
return vehicleBookRecord;
}
@Transactional
......@@ -647,7 +747,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" you can only within 2 month");
throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
}
Boolean rs = Boolean.TRUE;
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
......@@ -726,7 +826,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
for( DateTime curDate = startDay;curDate.compareTo(endDay)<=0;curDate=curDate.plusDays(1)){
String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER);
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);
if(!yearMonthAndDate.containsKey(curYearMonth)){
......@@ -737,7 +837,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" you can only within 2 month");
throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
}
}
......@@ -756,7 +856,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" you can only within 2 month");
throw new CustomIllegalParamException(" 只可以预约两个月内的车辆");
}
Boolean rs = Boolean.TRUE;
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
......@@ -777,7 +877,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
params.put("yearMonth",yearMonth);
//加入更新条件
if(CollectionUtils.isEmpty(unbookDates)){
throw new CustomIllegalParamException(" there are no day to unbook ");
throw new CustomIllegalParamException(" 车辆不可预定");
}
Map<String,List<String>> yearMonthAndDate = new HashMap<>();
yearMonthAndDate.put(yearMonth,unbookDates);
......@@ -804,7 +904,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
public void fillBookedDateSearchParam(Map<String, Object> params,
Map<String,List<String>> yearMonthAndDate,Map<String,List<String>> 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<>();
......@@ -849,7 +949,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
for (String dateStr:entry.getValue()) {//已预定作为条件,该位与1作与运算必定为1
if(bookedYearMonth.contains(dateStr)){
throw new CustomIllegalParamException(" 同一天既作为未预定查询条件又作为已预定查询条件");
throw new CustomIllegalParamException("同一天既作为未预定查询条件又作为已预定查询条件");
}
DateTime dateTime = DateTime.parse(dateStr, DEFAULT_DATE_TIME_FORMATTER);
//仅对应位为1的整形值
......
......@@ -122,6 +122,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
}
vehicleBookRecordQueryVo.setCompanyIds(companyId.split(","));
}
} else {
vehicleBookRecordQueryVo.setZoneIds((vehicleBookRecordQueryVo.getZoneId() + "").split(","));
vehicleBookRecordQueryVo.setCompanyIds((vehicleBookRecordQueryVo.getLiftCompany() + "").split(","));
}
List<VehicleBookRecordVo> list = mapper.getBookRecord(vehicleBookRecordQueryVo);
PageHelper.startPage(pageNo,pageSize);
......@@ -137,6 +140,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
if(userDTO == null) {
return RestResponse.codeAndMessage(235, "token失效");
}
vehicleBookRecordQueryVo.setUserCompany(userDTO.getCompanyId());
if(vehicleBookRecordQueryVo.getZoneId() == null) { //默认查出所有权限内的数据
if(DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据
String zoneId = null;
......@@ -162,6 +166,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
}
vehicleBookRecordQueryVo.setCompanyIds(companyId.split(","));
}
} else {
vehicleBookRecordQueryVo.setZoneIds((vehicleBookRecordQueryVo.getZoneId() + ",").split(","));
vehicleBookRecordQueryVo.setCompanyIds((vehicleBookRecordQueryVo.getLiftCompany() + ",").split(","));
}
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(vehicleBookRecordQueryVo);
PageHelper.startPage(pageNo,pageSize);
......
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.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
......@@ -26,15 +27,12 @@ import java.util.List;
@Service
public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, VehicleDepartureLog> {
@Autowired
VehicleDepartureLogMapper vehicleDepartureLogMapper;
@Autowired
VehicleMapper vehicleMapper;
public PageInfo<VehicleDepartureLogVo> page(String numberPlate, String time, Integer page, Integer 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) {
......@@ -42,12 +40,12 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
if (companyList == null || companyList.size() == 0) {
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) {
PageHelper.startPage(page, limit);
return new PageInfo<>(vehicleDepartureLogMapper.selectByVehicleId(vehicleId));
return new PageInfo<>(mapper.selectByVehicleId(vehicleId));
}
public VehicleDepartureStatisticDataVo statistic(String numberPlate) {
......@@ -61,28 +59,32 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
// 出行次数
VehicleDepartureLog departureLog = new VehicleDepartureLog();
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;
}
@Transactional
public ObjectRestResponse save(VehicleDepartureLog vehicleDepartureLog) {
Integer id = vehicleDepartureLog.getId();
if (id == null || id == 0) {
vehicleDepartureLog.setCreateTime(new Date());
vehicleDepartureLog.setState(0);
insertSelective(vehicleDepartureLog);
} else {
vehicleDepartureLog.setUpdateTime(new Date());
updateSelectiveById(vehicleDepartureLog);
}
vehicleDepartureLog.setUpdateTime(new Date());
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();
}
......
......@@ -12,11 +12,13 @@ import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.SysRegion;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.assertj.core.util.Arrays;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
......@@ -29,35 +31,37 @@ public class SysRegionController extends BaseController<SysRegionBiz> {
/**
* 父类id获取子类对象
*
* @param id
* @return
*/
@IgnoreUserToken
@RequestMapping(value ="/sons/{id}",method = RequestMethod.GET)
public RestResponse<List<SysRegion>> getSonRegion(@PathVariable Long id){
@RequestMapping(value = "/sons/{id}", method = RequestMethod.GET)
public RestResponse<List<SysRegion>> getSonRegion(@PathVariable Long id) {
return RestResponse.data(baseBiz.getSonRegion(id));
}
/**
* 通过属性获取省
*
* @param type
* @return
*/
@IgnoreUserToken
@RequestMapping(value ="/getSonRegionByType/{type}",method = RequestMethod.GET)
public RestResponse<List<SysRegion>> getSysRegionByType(@PathVariable Integer type){
@RequestMapping(value = "/getSonRegionByType/{type}", method = RequestMethod.GET)
public RestResponse<List<SysRegion>> getSysRegionByType(@PathVariable Integer type) {
return RestResponse.data(baseBiz.getSysRegionByType(type));
}
@RequestMapping(value ="",method = RequestMethod.GET)
public RestResponse<List<SysRegion>> getRegion(@RequestParam String idListJson){
@RequestMapping(value = "", method = RequestMethod.GET)
public RestResponse<List<SysRegion>> getRegion(@RequestParam String idListJson) {
try {
List<Long> ids = JSON.parseArray(idListJson,Long.class);
List<Long> ids = JSON.parseArray(idListJson, Long.class);
return RestResponse.data(baseBiz.getRegionsByCodes(ids));
} catch (JSONException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} catch (CustomIllegalParamException ex){
} catch (CustomIllegalParamException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
}
......@@ -65,46 +69,52 @@ public class SysRegionController extends BaseController<SysRegionBiz> {
/**
* 根据多个id查找省份
*
* @param ids
* @return
*/
@GetMapping("/getSysRegionByIds/{ids}")
public RestResponse getSysRegionByIds(@PathVariable String ids){
public RestResponse getSysRegionByIds(@PathVariable String ids) {
Example exam = Example.builder(SysRegion.class)
.where(WeekendSqls.<SysRegion>custom()
.andIn(SysRegion::getId, Arrays.asList(ids.split(",")))).build();
return RestResponse.suc( baseBiz.selectByExample(exam));
return RestResponse.suc(baseBiz.selectByExample(exam));
}
/**
* 根据一个id获取城市
*
* @param id
* @return
*/
@GetMapping("/getSysRegionById/{id}")
public RestResponse getSysRegionById(@PathVariable Integer id){
public RestResponse getSysRegionById(@PathVariable Integer id) {
Example exam = Example.builder(SysRegion.class)
.where(WeekendSqls.<SysRegion>custom()
.andEqualTo(SysRegion::getId,id)).build();
.andEqualTo(SysRegion::getId, id)).build();
List<SysRegion> sysRegions = baseBiz.selectByExample(exam);
if (sysRegions==null||sysRegions.size()!=1) {
if (sysRegions == null || sysRegions.size() != 1) {
RestResponse.suc();
}
return RestResponse.suc( sysRegions.get(0));
return RestResponse.suc(sysRegions.get(0));
}
/**
* 根据一个id获取城市
* @param ids
*
* @param idSet
* @return
*/
@PostMapping("/getSysRegionByIds")
public ObjectRestResponse<List<SysRegion>> getSysRegionByIds(@RequestBody Set<Integer> ids){
Example exam = Example.builder(SysRegion.class)
.where(WeekendSqls.<SysRegion>custom()
.andIn(SysRegion::getId,ids)
).build();
@PostMapping("/getSysRegion")
public ObjectRestResponse<List<SysRegion>> getSysRegion(@RequestBody Set<Integer> idSet) {
if (CollectionUtils.isEmpty(idSet)){
return ObjectRestResponse.succ();
}
Example exam = new Example(SysRegion.class);
Example.Criteria criteria = exam.createCriteria();
criteria.andIn("id",idSet);
List<SysRegion> sysRegions = baseBiz.selectByExample(exam);
return ObjectRestResponse.succ(sysRegions);
......
......@@ -199,7 +199,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
}
/**
* 申请预定车辆
* 申请预定车辆 不需要审核
*
* @param bookVehicleVo
* @return
......@@ -213,6 +213,21 @@ public class VehicleController extends BaseController<VehicleBiz> {
return RestResponse.suc();
}
/**
* 申请预定车辆 需要审核
*
* @param bookVehicleVo
* @return
*/
@RequestMapping(value = "/apply/book/vehicle", method = RequestMethod.POST)
@ApiOperation(value = "申请预定车辆信息")
public RestResponse<Integer> applyForVehicle(@RequestBody BookVehicleVO bookVehicleVo) throws Exception {
Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID());
String userName = BaseContextHandler.getName();
baseBiz.applyForVehicle(operatorId, bookVehicleVo, userName);
return RestResponse.suc();
}
/**
* 批准预定车辆预定
*
......@@ -446,13 +461,13 @@ public class VehicleController extends BaseController<VehicleBiz> {
}
@GetMapping(value = "/app/unauth/getBookRecord")
@ApiOperation(value = "获取排班记录")
@ApiOperation(value = "获取预定记录")
public RestResponse<PageDataVO> getRecord(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) {
return vehicleBookRecordBiz.getBookRecord(vehicleBookRecordQueryVo);
}
@GetMapping(value = "/app/unauth/getBookRecordInfo")
@ApiOperation(value = "获取排班记录信息")
@ApiOperation(value = "获取预定记录信息")
public RestResponse<PageDataVO> getBookRecordInfo(VehicleBookRecordQueryVo vehicleBookRecordQueryVo) {
return vehicleBookRecordBiz.getBookRecordInfo(vehicleBookRecordQueryVo);
}
......
......@@ -34,9 +34,8 @@ public class CityController extends BaseController<VehicleBiz> {
*/
@GetMapping("/corporationCity")
public ObjectRestResponse<Set<Integer>> corporationCity(
@RequestParam("zoneList") String zoneList,
@RequestParam("companyList") String companyList) {
@RequestParam(value = "zoneList",defaultValue = "") String zoneList,
@RequestParam(value = "companyList",defaultValue = "") String companyList) {
return ObjectRestResponse.succ(branchCompanyBiz.getCity(zoneList,companyList));
}
}
......@@ -417,7 +417,7 @@
<select id="getBookRecordInfo" resultMap="searchBookRecord" parameterType="com.xxfc.platform.vehicle.pojo.VehicleBookRecordQueryVo">
select v3.number_plate, 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
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)
......@@ -442,7 +442,6 @@
<foreach collection="companyIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="zoneIds != null">
and bc1.zone_id in
......
......@@ -18,9 +18,8 @@
</select>
<select id="selectByBookRecordId" parameterType="java.lang.Integer" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo">
select vehicle_departure_log.*,vehicle.number_plate
select 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}
order by create_time desc
</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