Commit 01dc4858 authored by libin's avatar libin

Merge remote-tracking branch 'origin/dev' into dev

parents b3b16c21 adfa0298
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform-web</artifactId> <artifactId>xx-common-platform-web</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform-web/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
......
...@@ -19,6 +19,9 @@ public interface ConfigFeign { ...@@ -19,6 +19,9 @@ public interface ConfigFeign {
*/ */
public static final int TYPE_CUS_SER = 400; public static final int TYPE_CUS_SER = 400;
//旅游提前天数
public static final int TYPE_TOUR_DAYS=99;
@RequestMapping(value = "/cofig/app/unauth/types",method = RequestMethod.GET) @RequestMapping(value = "/cofig/app/unauth/types",method = RequestMethod.GET)
ObjectRestResponse<List<Cofig>> getAllByType(@RequestParam("types") String types); ObjectRestResponse<List<Cofig>> getAllByType(@RequestParam("types") String types);
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<artifactId>xx-common-platform-web</artifactId> <artifactId>xx-common-platform-web</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform-web/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<artifactId>xx-common-platform-web</artifactId> <artifactId>xx-common-platform-web</artifactId>
<groupId>com.xxfc.common</groupId> <groupId>com.xxfc.common</groupId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<relativePath>../../xx-common/xx-common-platform-web/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -145,7 +145,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -145,7 +145,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//扣減庫存 //扣減庫存
ObjectRestResponse<TourSpePriceVo> response = tourFeign.stock(bo.getSpePriceId(), bo.getTotalNumber(), TourFeign.STOCK_SUBTRACT); ObjectRestResponse<TourSpePriceVo> response = tourFeign.stock(bo.getSpePriceId(), bo.getTotalNumber(), TourFeign.STOCK_SUBTRACT);
if(!SYS_JSON_TRUE.equals(response.getStatus())) { if(!SYS_JSON_TRUE.equals(response.getStatus())) {
throw new BaseException(ResultCode.PARAM_EPIRE_CODE, Sets.newSet("库存不足")); throw new BaseException(ResultCode.PARAM_EPIRE_CODE, Sets.newSet(response.getMessage()));
} }
......
...@@ -18,6 +18,13 @@ ...@@ -18,6 +18,13 @@
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-app-api</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -4,6 +4,8 @@ import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel; ...@@ -4,6 +4,8 @@ import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.tour.dto.GoodBannerDTO; import com.xxfc.platform.tour.dto.GoodBannerDTO;
import com.xxfc.platform.tour.dto.GoodTagDTO; import com.xxfc.platform.tour.dto.GoodTagDTO;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
...@@ -45,6 +47,8 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -45,6 +47,8 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
private UserFeign userFeign; private UserFeign userFeign;
@Autowired @Autowired
TourGoodBannerMapper bannerMapper; TourGoodBannerMapper bannerMapper;
@Autowired
ConfigFeign configFeign;
//获取商品详情 //获取商品详情
public ObjectRestResponse<TourGoodDetailVo> getGoodDetaileById(Integer id) { public ObjectRestResponse<TourGoodDetailVo> getGoodDetaileById(Integer id) {
...@@ -79,7 +83,7 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -79,7 +83,7 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
List<GoodBannerDTO> bannerList = bannerMapper.getBannerList(id); List<GoodBannerDTO> bannerList = bannerMapper.getBannerList(id);
detailVo.setBannerDTOS(bannerList); detailVo.setBannerDTOS(bannerList);
//获取出行时间 //获取出行时间
List<TourDepartTimeVo> timelist = priceMapper.getAllByGoodId(id); List<TourDepartTimeVo> timelist = priceMapper.getAllByGoodId(id,getTourDays());
detailVo.setTourDepartTimeVo(timelist); detailVo.setTourDepartTimeVo(timelist);
Integer stock=priceMapper.getTotalStock(id); Integer stock=priceMapper.getTotalStock(id);
detailVo.setStock(stock); detailVo.setStock(stock);
...@@ -109,7 +113,7 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -109,7 +113,7 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
BeanUtils.copyProperties(detailVo, TourGood); BeanUtils.copyProperties(detailVo, TourGood);
BigDecimal price = detailVo.getPrice(); BigDecimal price = detailVo.getPrice();
//获取出行时间 //获取出行时间
List<TourDepartTimeVo> timelist = priceMapper.getAllByGoodId(id); List<TourDepartTimeVo> timelist = priceMapper.getAllByGoodId(id,getTourDays());
detailVo.setTourDepartTimeVo(timelist); detailVo.setTourDepartTimeVo(timelist);
//获取出发地点 //获取出发地点
List<TourDepartVo> departList = siteMapper.getlistByGoodId(id); List<TourDepartVo> departList = siteMapper.getlistByGoodId(id);
...@@ -135,5 +139,19 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -135,5 +139,19 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
return selectById(id); return selectById(id);
} }
//获取旅游天数
public Integer getTourDays(){
try {
List<Cofig> list=configFeign.getAllByType(ConfigFeign.TYPE_TOUR_DAYS+"").getData();
if (list!=null && list.size()>0){
String params=list.get(0).getValue();
return Integer.parseInt(params);
}
}catch (Exception e){
e.printStackTrace();
}
return 0;
}
} }
\ No newline at end of file
...@@ -11,11 +11,13 @@ import com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper; ...@@ -11,11 +11,13 @@ import com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper;
import com.xxfc.platform.tour.vo.TourSpePriceVo; import com.xxfc.platform.tour.vo.TourSpePriceVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -30,6 +32,9 @@ import java.util.List; ...@@ -30,6 +32,9 @@ import java.util.List;
@Slf4j @Slf4j
public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpePrice> { public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpePrice> {
@Autowired
TourGoodDetailBiz goodDetailBiz;
public ObjectRestResponse<TourSpePriceVo> getPricesByuserid(TourSpePriceDTO priceDto) { public ObjectRestResponse<TourSpePriceVo> getPricesByuserid(TourSpePriceDTO priceDto) {
if (priceDto == null || priceDto.getUserId() == null || priceDto.getUserId() == 0 || if (priceDto == null || priceDto.getUserId() == null || priceDto.getUserId() == 0 ||
priceDto.getNumber() == null || priceDto.getNumber() == 0||priceDto.getSpeId()==null) { priceDto.getNumber() == null || priceDto.getNumber() == 0||priceDto.getSpeId()==null) {
...@@ -89,6 +94,9 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP ...@@ -89,6 +94,9 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP
TourGoodSpePrice spePrice = mapper.selectByPrimaryKey(speId); TourGoodSpePrice spePrice = mapper.selectByPrimaryKey(speId);
if(type==1){ if(type==1){
if (spePrice != null && spePrice.getStock() > 0 && spePrice.getStock() >= number) { if (spePrice != null && spePrice.getStock() > 0 && spePrice.getStock() >= number) {
if (!checkTime(spePrice.getStartTime())){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "该日期已超过系统限制");
}
mapper.updStockById(speId, number,type); mapper.updStockById(speId, number,type);
} else { } else {
return ObjectRestResponse.createFailedResult(ResultCode.STOCK_CODE, "库存不足"); return ObjectRestResponse.createFailedResult(ResultCode.STOCK_CODE, "库存不足");
...@@ -109,4 +117,25 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP ...@@ -109,4 +117,25 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP
TourGoodSpePrice spePrice = mapper.selectOne(tourGoodSpePrice); TourGoodSpePrice spePrice = mapper.selectOne(tourGoodSpePrice);
return spePrice.getStartTime(); return spePrice.getStartTime();
} }
public boolean checkTime(Date startTime){
try {
Date endTime=new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
long startDateTime = dateFormat.parse(dateFormat.format(startTime)).getTime();
long endDateTime = dateFormat.parse(dateFormat.format(endTime)).getTime();
if (startDateTime<=endDateTime){
return false;
}
int days=(int)((startDateTime - endDateTime) / (1000 * 3600 * 24));
int tourDays=goodDetailBiz.getTourDays();
if (days>0&&days>=tourDays){
return true;
}
return false;
}catch (Exception e){
e.printStackTrace();
return false;
}
}
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
*/ */
public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> { public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> {
List<TourDepartTimeVo> getAllByGoodId(@Param("goodId") Integer goodId); List<TourDepartTimeVo> getAllByGoodId(@Param("goodId") Integer goodId,Integer days);
//获取总库存 //获取总库存
Integer getTotalStock(@Param("goodId") Integer goodId); Integer getTotalStock(@Param("goodId") Integer goodId);
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.tour.rest; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.tour.biz.TourGoodSpeBiz; import com.xxfc.platform.tour.biz.TourGoodSpeBiz;
import com.xxfc.platform.tour.common.TourBaseController; import com.xxfc.platform.tour.common.TourBaseController;
import com.xxfc.platform.tour.dto.TourSpePriceDTO; import com.xxfc.platform.tour.dto.TourSpePriceDTO;
...@@ -31,7 +32,13 @@ public class TourGoodSpeController extends TourBaseController<TourGoodSpeBiz> { ...@@ -31,7 +32,13 @@ public class TourGoodSpeController extends TourBaseController<TourGoodSpeBiz> {
@RequestParam(value = "number",defaultValue = "0") Integer number, @RequestParam(value = "number",defaultValue = "0") Integer number,
@RequestParam(value = "type",defaultValue = "1") Integer type @RequestParam(value = "type",defaultValue = "1") Integer type
){ ){
try {
return baseBiz.cutStock(speId,number,type); return baseBiz.cutStock(speId,number,type);
}catch (Exception e){
e.printStackTrace();
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"网络异常,稍后重试");
}
} }
@GetMapping("/departure_date") @GetMapping("/departure_date")
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<!-- 获取出行时间 --> <!-- 获取出行时间 -->
<select id="getAllByGoodId" resultMap="tourDepartTimeVoMap"> <select id="getAllByGoodId" resultMap="tourDepartTimeVoMap">
SELECT id,good_id,DATE_FORMAT(start_time,'%Y-%m-%d') as start_time,DATE_FORMAT(end_time,'%Y-%m-%d') as end_time,spe_id,price,child_price,member_price,stock, SELECT id,good_id,DATE_FORMAT(start_time,'%Y-%m-%d') as start_time,DATE_FORMAT(end_time,'%Y-%m-%d') as end_time,spe_id,price,child_price,member_price,stock,
DATE_FORMAT(start_time,'%w') as startWeek,DATE_FORMAT(end_time,'%w') as endWeek,IF(IFNULL(DATEDIFF(start_time,NOW()),0)>0,'0','1') as overdue DATE_FORMAT(start_time,'%w') as startWeek,DATE_FORMAT(end_time,'%w') as endWeek,IF(IFNULL(DATEDIFF(start_time,NOW()),0)>=#{days},'0','1') as overdue
FROM tour_good_spe_price WHERE good_id=#{goodId} and is_del=0 ORDER BY start_time FROM tour_good_spe_price WHERE good_id=#{goodId} and is_del=0 ORDER BY start_time
</select> </select>
......
...@@ -82,7 +82,7 @@ public class VehicleActiveService { ...@@ -82,7 +82,7 @@ public class VehicleActiveService {
throw new BaseException(ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getDesc(), throw new BaseException(ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getDesc(),
ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode()); ResCode.VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED.getCode());
} }
if(MileageLift==null||MileageLift1>=MileageLift){ if(MileageLift==null||MileageLift1 >= MileageLift){
// 写入车辆公里数,预计目的地 // 写入车辆公里数,预计目的地
vehicle.setMileageLastUpdate(MileageLift1); vehicle.setMileageLastUpdate(MileageLift1);
vehicle.setExpectDestinationBranchCompanyId(departureVo.getExpectArrivalBranchCompanyId()); vehicle.setExpectDestinationBranchCompanyId(departureVo.getExpectArrivalBranchCompanyId());
...@@ -233,6 +233,7 @@ public class VehicleActiveService { ...@@ -233,6 +233,7 @@ public class VehicleActiveService {
} }
DateTime arrivalDate = new DateTime(vehicleBookRecord.getBookEndDate()); DateTime arrivalDate = new DateTime(vehicleBookRecord.getBookEndDate());
DateTime actualArrivalDate = new DateTime(new Date()); DateTime actualArrivalDate = new DateTime(new Date());
//提前还车处理
if(actualArrivalDate.compareTo(arrivalDate) < 0) { //实际还车时间小于预计还车时间,需要释放后面的时间 if(actualArrivalDate.compareTo(arrivalDate) < 0) { //实际还车时间小于预计还车时间,需要释放后面的时间
BookVehicleVO bookVehicleVo = new BookVehicleVO(); BookVehicleVO bookVehicleVo = new BookVehicleVO();
BeanUtils.copyProperties(vehicleBookRecord, bookVehicleVo); BeanUtils.copyProperties(vehicleBookRecord, bookVehicleVo);
......
...@@ -88,7 +88,7 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V ...@@ -88,7 +88,7 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
predictableHours.put(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), startPredictableHour); predictableHours.put(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), startPredictableHour);
predictableHours.put(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), endPredictableHour); predictableHours.put(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), endPredictableHour);
} }
if(endDay.getMillis() - startDay.getMillis() > 24 * 3600 * 1000){ // if(endDay.getMillis() - startDay.getMillis() > 24 * 3600 * 1000 ){ //
for (DateTime curDate = startDay.plusDays(1); curDate.compareTo(endDay) < 0; curDate = curDate.plusDays(1)) { for (DateTime curDate = startDay.plusDays(1); curDate.compareTo(endDay) < 0; curDate = curDate.plusDays(1)) {
String curDateStr = curDate.toString(DATE_TIME_FORMATTER); String curDateStr = curDate.toString(DATE_TIME_FORMATTER);
//全天预定 //全天预定
......
...@@ -70,6 +70,9 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -70,6 +70,9 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
@Autowired @Autowired
private VehicleJobHandler vehicleJobHandler; private VehicleJobHandler vehicleJobHandler;
@Autowired
private VehicleBookHourInfoBiz vehicleBookHourInfoBiz;
@Autowired @Autowired
BranchCompanyBiz branchCompanyBiz; BranchCompanyBiz branchCompanyBiz;
@Autowired @Autowired
......
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