Commit 19bfa285 by lanpingxiong

Merge branch 'dev/lanpingxiong' into 'master'

Dev/lanpingxiong

See merge request hewei/Jumeirah!83
parents a0d51828 b80635d9
...@@ -41,13 +41,13 @@ public class PlainTypeController extends BaseController { ...@@ -41,13 +41,13 @@ public class PlainTypeController extends BaseController {
private PlainTypeService plainTypeService; private PlainTypeService plainTypeService;
/** /**
* 飞机型号表分页列表 * app端飞机型号表分页列表
*/ */
@GetMapping("/getAllMap") @GetMapping("/getAllMap")
@OperationLog(name = "分组获取飞机型号列表", type = OperationLogType.PAGE) @OperationLog(name = "分组获取飞机型号列表", type = OperationLogType.PAGE)
@ApiOperation(value = "分组获取飞机型号列表", response = PlainTypeQueryVo.class) @ApiOperation(value = "分组获取飞机型号列表", response = PlainTypeQueryVo.class)
public ApiResult<List<PlainTypeBo>> getAllMap() throws Exception { public ApiResult<List<PlainTypeBo>> getAllMap() throws Exception {
List<PlainType> plainTypeList = plainTypeService.getAllMap(); List<PlainType> plainTypeList = plainTypeService.getAppPlainTypePageList();
Map<Integer, List<PlainType>> resultMap; Map<Integer, List<PlainType>> resultMap;
List<PlainTypeBo> plainTypeBoList = new ArrayList<>(); List<PlainTypeBo> plainTypeBoList = new ArrayList<>();
if (!CollectionUtils.isEmpty(plainTypeList)) { if (!CollectionUtils.isEmpty(plainTypeList)) {
......
...@@ -48,5 +48,16 @@ public class McPlainTypeController extends BaseController { ...@@ -48,5 +48,16 @@ public class McPlainTypeController extends BaseController {
return ApiResult.ok(plainTypeList); return ApiResult.ok(plainTypeList);
} }
/**
* 获取空闲飞机型号列表
*/
@GetMapping("/mcPageList")
@OperationLog(name = "获取空闲飞机型号列表", type = OperationLogType.PAGE)
@ApiOperation(value = "获取空闲飞机型号列表", response = PlainTypeQueryVo.class)
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<List<PlainType> > getMcPlainTypePageList() throws Exception {
List<PlainType> plainTypePageList = plainTypeService.getAppPlainTypePageList();
return ApiResult.ok(plainTypePageList);
}
} }
package com.jumeirah.api.merchant.controller.order; package com.jumeirah.api.merchant.controller.order;
import com.jumeirah.api.merchant.entity.param.StrokeCompleteParam; import com.jumeirah.common.param.StrokeCompleteParam;
import com.jumeirah.api.merchant.entity.param.StrokeConfirmPaymentParam; import com.jumeirah.api.merchant.entity.param.StrokeConfirmPaymentParam;
import com.jumeirah.api.merchant.entity.param.StrokeDiscountCheckParam; import com.jumeirah.api.merchant.entity.param.StrokeDiscountCheckParam;
import com.jumeirah.api.merchant.entity.param.StrokeQuotedPriceParam;
import com.jumeirah.common.entity.AppUser; import com.jumeirah.common.entity.AppUser;
import com.jumeirah.common.entity.Stroke; import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.enums.StatePaymentStatusEnum; import com.jumeirah.common.enums.StatePaymentStatusEnum;
import com.jumeirah.common.enums.StrokeStatusEnum; import com.jumeirah.common.enums.StrokeStatusEnum;
import com.jumeirah.common.factory.PushFactory; import com.jumeirah.common.factory.PushFactory;
import com.jumeirah.common.param.McStrokePageParam; import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.StrokeQuotedPriceParam;
import com.jumeirah.common.service.AppUserService; import com.jumeirah.common.service.AppUserService;
import com.jumeirah.common.service.StrokeService; import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.vo.McStrokeQueryVo; import com.jumeirah.common.vo.McStrokeQueryVo;
...@@ -23,11 +23,11 @@ import io.swagger.annotations.Api; ...@@ -23,11 +23,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -60,17 +60,16 @@ public class McStrokeController extends BaseController { ...@@ -60,17 +60,16 @@ public class McStrokeController extends BaseController {
@ApiOperation(value = "完成行程接口", response = ApiResult.class) @ApiOperation(value = "完成行程接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit") @RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> completeStroke(@Validated @RequestBody StrokeCompleteParam strokeCompleteParam) throws Exception { public ApiResult<Boolean> completeStroke(@Validated @RequestBody StrokeCompleteParam strokeCompleteParam) throws Exception {
Stroke stroke = new Stroke(); ApiResult<Boolean> result = strokeService.completeStroke(strokeCompleteParam);
stroke.setId(strokeCompleteParam.getId()) if (result.getData()) {
.setUpdateTime(new Timestamp(System.currentTimeMillis()))
.setStatus(StrokeStatusEnum.COMPLETED.getCode());
boolean flag = strokeService.updateStroke(stroke);
sendAppMsg(strokeCompleteParam.getId(), "3", "您的订单已完成"); sendAppMsg(strokeCompleteParam.getId(), "3", "您的订单已完成");
return ApiResult.result(flag); }
return result;
} }
/** /**
* 发送推送信息给APP端 * 发送推送信息给APP端
*
* @param id * @param id
* @param pushType * @param pushType
* @param title * @param title
...@@ -89,8 +88,8 @@ public class McStrokeController extends BaseController { ...@@ -89,8 +88,8 @@ public class McStrokeController extends BaseController {
@OperationLog(name = "行程分页列表", type = OperationLogType.PAGE) @OperationLog(name = "行程分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程分页列表") @ApiOperation(value = "行程分页列表")
@RequiresPermissions("merchant:order:view") @RequiresPermissions("merchant:order:view")
public ApiResult<Paging<McStrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody McStrokePageParam mcStrokePageParam) throws Exception { public ApiResult<Paging<McStrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody McStrokePageParam mcStrokePageParam, @RequestHeader(required = false) String language) throws Exception {
Paging<McStrokeQueryVo> paging = strokeService.getMcStrokePageList(mcStrokePageParam); Paging<McStrokeQueryVo> paging = strokeService.getMcStrokePageList(mcStrokePageParam, language);
return ApiResult.ok(paging); return ApiResult.ok(paging);
} }
...@@ -102,12 +101,11 @@ public class McStrokeController extends BaseController { ...@@ -102,12 +101,11 @@ public class McStrokeController extends BaseController {
@ApiOperation(value = "行程报价接口", response = ApiResult.class) @ApiOperation(value = "行程报价接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit") @RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> updateStroke(@Validated @RequestBody StrokeQuotedPriceParam strokeQuotedPriceParam) throws Exception { public ApiResult<Boolean> updateStroke(@Validated @RequestBody StrokeQuotedPriceParam strokeQuotedPriceParam) throws Exception {
Stroke stroke = new Stroke(); ApiResult<Boolean> result = strokeService.quotedPrice(strokeQuotedPriceParam);
BeanUtils.copyProperties(strokeQuotedPriceParam, stroke); if (result.getData()) {
stroke.setUpdateTime(new Timestamp(System.currentTimeMillis()));
boolean flag = strokeService.updateStroke(stroke);
sendAppMsg(strokeQuotedPriceParam.getId(), "2", "您的订单已报价"); sendAppMsg(strokeQuotedPriceParam.getId(), "2", "您的订单已报价");
return ApiResult.result(flag); }
return result;
} }
/** /**
......
package com.jumeirah.api.merchant.controller.plain; package com.jumeirah.api.merchant.controller.plain;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.api.merchant.entity.param.McPlainAddParam; import com.jumeirah.api.merchant.entity.param.McPlainAddParam;
import com.jumeirah.common.entity.McPlain; import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.entity.PlainType; import com.jumeirah.common.entity.PlainType;
...@@ -60,10 +61,15 @@ public class McPlainController extends BaseController { ...@@ -60,10 +61,15 @@ public class McPlainController extends BaseController {
if (checkPtId(mcPlainAddParam)) { if (checkPtId(mcPlainAddParam)) {
return ApiResult.result(ApiCode.PLAIN_TYPE_NOT_FOUND, null); return ApiResult.result(ApiCode.PLAIN_TYPE_NOT_FOUND, null);
} }
//先判断商家此机型是否已经添加过
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
if (checkMcPlain(mcPlainAddParam.getPtId(), jwtToken.getMcId())) {
return ApiResult.result(ApiCode.MC_PLANE_EXISTED, false);
}
McPlain mcPlain = new McPlain(); McPlain mcPlain = new McPlain();
BeanUtils.copyProperties(mcPlainAddParam, mcPlain); BeanUtils.copyProperties(mcPlainAddParam, mcPlain);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); mcPlain.setMcId(jwtToken.getMcId())
mcPlain.setMcId(jwtToken.getMcId()); .setIdleNum(mcPlainAddParam.getAmount());
boolean flag = mcPlainService.saveMcPlain(mcPlain); boolean flag = mcPlainService.saveMcPlain(mcPlain);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
...@@ -87,12 +93,41 @@ public class McPlainController extends BaseController { ...@@ -87,12 +93,41 @@ public class McPlainController extends BaseController {
if (checkPtId(mcPlainAddParam)) { if (checkPtId(mcPlainAddParam)) {
return ApiResult.result(ApiCode.PLAIN_TYPE_NOT_FOUND, null); return ApiResult.result(ApiCode.PLAIN_TYPE_NOT_FOUND, null);
} }
//先判断商家此机型是否已经添加过
McPlain oldMcPlain = mcPlainService.getById(mcPlainAddParam.getId());
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
if (oldMcPlain.getPtId().longValue() != mcPlainAddParam.getPtId().longValue()) {
if (checkMcPlain(mcPlainAddParam.getPtId(), jwtToken.getMcId())) {
return ApiResult.result(ApiCode.MC_PLANE_EXISTED, false);
}
}
int idleNum = oldMcPlain.getIdleNum();
if (mcPlainAddParam.getAmount() < oldMcPlain.getAmount()) {
//减少数量
idleNum = oldMcPlain.getIdleNum() - (oldMcPlain.getAmount() - mcPlainAddParam.getAmount());
idleNum = idleNum >= 0 ? idleNum : 0;
} else if (oldMcPlain.getAmount() < mcPlainAddParam.getAmount()) {
//增加数量
idleNum = oldMcPlain.getIdleNum() + (mcPlainAddParam.getAmount() - oldMcPlain.getAmount());
idleNum = idleNum >= mcPlainAddParam.getAmount() ? mcPlainAddParam.getAmount() : idleNum;
}
McPlain mcPlain = new McPlain(); McPlain mcPlain = new McPlain();
BeanUtils.copyProperties(mcPlainAddParam, mcPlain); BeanUtils.copyProperties(mcPlainAddParam, mcPlain);
mcPlain.setIdleNum(idleNum);
boolean flag = mcPlainService.updateMcPlain(mcPlain); boolean flag = mcPlainService.updateMcPlain(mcPlain);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
private boolean checkMcPlain(Long ptId, Long mcId) {
McPlain oldMcPlain = mcPlainService.getOne(new QueryWrapper<McPlain>().lambda()
.eq(McPlain::getPtId, ptId)
.eq(McPlain::getMcId, mcId));
if (oldMcPlain != null) {
return true;
}
return false;
}
/** /**
* 删除商家飞机表 * 删除商家飞机表
*/ */
......
...@@ -58,4 +58,7 @@ public class McPlain extends BaseEntity { ...@@ -58,4 +58,7 @@ public class McPlain extends BaseEntity {
@ApiModelProperty("所在地城市ID") @ApiModelProperty("所在地城市ID")
private Long cityId; private Long cityId;
@ApiModelProperty("空闲数量")
private Integer idleNum;
} }
...@@ -130,18 +130,6 @@ public class Stroke extends BaseEntity { ...@@ -130,18 +130,6 @@ public class Stroke extends BaseEntity {
@ApiModelProperty("到达机场名称") @ApiModelProperty("到达机场名称")
private String arriveAirportName; private String arriveAirportName;
@NotNull(message = "返程飞机型号ID为空")
@ApiModelProperty("返程飞机型号ID")
private Long arrivePlainTypeId;
@NotBlank(message = "返程出发机场名称不能为空")
@ApiModelProperty("返程出发机场名称")
private String backOutsetAirportName;
@NotBlank(message = "返程到达机场名称不能为空")
@ApiModelProperty("返程到达机场名称")
private String backArriveAirportName;
@NotNull(message = "商家id不能为空") @NotNull(message = "商家id不能为空")
@ApiModelProperty("商家id") @ApiModelProperty("商家id")
private Long mcId; private Long mcId;
......
...@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* 飞机型号表 Mapper 接口 * 飞机型号表 Mapper 接口
...@@ -39,4 +40,10 @@ public interface PlainTypeMapper extends BaseMapper<PlainType> { ...@@ -39,4 +40,10 @@ public interface PlainTypeMapper extends BaseMapper<PlainType> {
*/ */
IPage<PlainTypeQueryVo> getPlainTypePageList(@Param("page") Page page, @Param("param") PlainTypePageParam plainTypePageParam); IPage<PlainTypeQueryVo> getPlainTypePageList(@Param("page") Page page, @Param("param") PlainTypePageParam plainTypePageParam);
/**
* app端飞机型号表分页列表
* @return
*/
List<PlainType> getAppPlainTypePageList();
} }
...@@ -65,11 +65,12 @@ public interface StrokeMapper extends BaseMapper<Stroke> { ...@@ -65,11 +65,12 @@ public interface StrokeMapper extends BaseMapper<Stroke> {
* @param page * @param page
* @param mcStrokePageParam * @param mcStrokePageParam
* @param mcId * @param mcId
* @param language
* @return * @return
*/ */
IPage<McStrokeQueryVo> getMcStrokePageList( IPage<McStrokeQueryVo> getMcStrokePageList(
@Param("page") Page page, @Param("mcStrokePageParam") McStrokePageParam mcStrokePageParam, @Param("page") Page page, @Param("mcStrokePageParam") McStrokePageParam mcStrokePageParam,
@Param("mcId") long mcId); @Param("mcId") long mcId, @Param("language") String language);
/** /**
* 收款记录 * 收款记录
...@@ -90,6 +91,6 @@ public interface StrokeMapper extends BaseMapper<Stroke> { ...@@ -90,6 +91,6 @@ public interface StrokeMapper extends BaseMapper<Stroke> {
* @param id * @param id
* @return * @return
*/ */
McStrokeQueryVo getStrokeInfo(@Param("mcId") Long mcId,@Param("id") Long id); McStrokeQueryVo getStrokeInfo(@Param("mcId") Long mcId, @Param("id") Long id);
} }
package com.jumeirah.api.merchant.entity.param; package com.jumeirah.common.param;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity; import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
......
package com.jumeirah.api.merchant.entity.param; package com.jumeirah.common.param;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity; import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
......
...@@ -66,4 +66,11 @@ public interface PlainTypeService extends BaseService<PlainType> { ...@@ -66,4 +66,11 @@ public interface PlainTypeService extends BaseService<PlainType> {
* @return * @return
*/ */
List<PlainType> getAllMap(); List<PlainType> getAllMap();
/**
* 飞机型号表分页列表
* @return
*/
List<PlainType> getAppPlainTypePageList();
} }
...@@ -3,11 +3,14 @@ package com.jumeirah.common.service; ...@@ -3,11 +3,14 @@ package com.jumeirah.common.service;
import com.jumeirah.common.entity.Stroke; import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.param.McStrokePageParam; import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.McStrokePaymentPageParam; import com.jumeirah.common.param.McStrokePaymentPageParam;
import com.jumeirah.common.param.StrokeCompleteParam;
import com.jumeirah.common.param.StrokePageParam; import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.param.StrokeQuotedPriceParam;
import com.jumeirah.common.vo.McStrokePaymentQueryVo; import com.jumeirah.common.vo.McStrokePaymentQueryVo;
import com.jumeirah.common.vo.McStrokeQueryVo; import com.jumeirah.common.vo.McStrokeQueryVo;
import com.jumeirah.common.vo.StrokeDetailVo; import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo; import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.service.BaseService; import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging; import io.geekidea.springbootplus.framework.core.pagination.Paging;
...@@ -73,9 +76,10 @@ public interface StrokeService extends BaseService<Stroke> { ...@@ -73,9 +76,10 @@ public interface StrokeService extends BaseService<Stroke> {
* 商家端,分页获取行程接口 * 商家端,分页获取行程接口
* *
* @param mcStrokePageParam * @param mcStrokePageParam
* @param language
* @return * @return
*/ */
Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam); Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam, String language);
/** /**
* 收款记录 * 收款记录
...@@ -84,4 +88,18 @@ public interface StrokeService extends BaseService<Stroke> { ...@@ -84,4 +88,18 @@ public interface StrokeService extends BaseService<Stroke> {
* @return * @return
*/ */
Paging<McStrokePaymentQueryVo> getPaymentPageList(McStrokePaymentPageParam mcStrokePaymentPageParam); Paging<McStrokePaymentQueryVo> getPaymentPageList(McStrokePaymentPageParam mcStrokePaymentPageParam);
/**
* 商家端行程报价接口
* @param strokeQuotedPriceParam
* @return
*/
ApiResult<Boolean> quotedPrice(StrokeQuotedPriceParam strokeQuotedPriceParam) throws Exception;
/**
* 完成行程接口
* @param strokeCompleteParam
* @return
*/
ApiResult<Boolean> completeStroke(StrokeCompleteParam strokeCompleteParam) throws Exception;
} }
...@@ -71,4 +71,9 @@ public class PlainTypeServiceImpl extends BaseServiceImpl<PlainTypeMapper, Plain ...@@ -71,4 +71,9 @@ public class PlainTypeServiceImpl extends BaseServiceImpl<PlainTypeMapper, Plain
); );
} }
@Override
public List<PlainType> getAppPlainTypePageList() {
return plainTypeMapper.getAppPlainTypePageList();
}
} }
package com.jumeirah.common.service.impl; package com.jumeirah.common.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.entity.Stroke; import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.enums.StrokeStatusEnum; import com.jumeirah.common.enums.StrokeStatusEnum;
import com.jumeirah.common.mapper.StrokeMapper; import com.jumeirah.common.mapper.StrokeMapper;
import com.jumeirah.common.mq.Queue; import com.jumeirah.common.mq.Queue;
import com.jumeirah.common.param.McStrokePageParam; import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.McStrokePaymentPageParam; import com.jumeirah.common.param.McStrokePaymentPageParam;
import com.jumeirah.common.param.StrokeCompleteParam;
import com.jumeirah.common.param.StrokePageParam; import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.param.StrokeQuotedPriceParam;
import com.jumeirah.common.service.StrokeService; import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.vo.McStrokePaymentQueryVo; import com.jumeirah.common.vo.McStrokePaymentQueryVo;
import com.jumeirah.common.vo.McStrokeQueryVo; import com.jumeirah.common.vo.McStrokeQueryVo;
import com.jumeirah.common.vo.StrokeDetailVo; import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo; import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiCode;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo; import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import io.geekidea.springbootplus.framework.core.pagination.Paging; import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken; import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
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;
import java.sql.Timestamp;
/** /**
* 行程表 服务实现类 * 行程表 服务实现类
* *
...@@ -41,6 +49,8 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp ...@@ -41,6 +49,8 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
@Autowired @Autowired
private StrokeMapper strokeMapper; private StrokeMapper strokeMapper;
@Autowired
private McPlainServiceImpl mcPlainService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -99,7 +109,7 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp ...@@ -99,7 +109,7 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
@Override @Override
public Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam, String language) throws Exception { public Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam, String language) throws Exception {
// Page<StrokeQueryVo> page = new PageInfo<>(strokePageParam, OrderItem.asc(getLambdaColumn(Stroke::getCreateTime))); // Page<StrokeQueryVo> page = new PageInfo<>(strokePageParam, OrderItem.asc(getLambdaColumn(Stroke::getCreateTime)));
Page<StrokeQueryVo> page = new PageInfo<>(strokePageParam, OrderItem.desc("s.create_time")); Page<StrokeQueryVo> page = new PageInfo<>(strokePageParam);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
// 查询已完成 需要额外查询已取消状态 // 查询已完成 需要额外查询已取消状态
if (strokePageParam.getStatus().equals(StrokeStatusEnum.COMPLETED.getCode())) { if (strokePageParam.getStatus().equals(StrokeStatusEnum.COMPLETED.getCode())) {
...@@ -111,10 +121,10 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp ...@@ -111,10 +121,10 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
} }
@Override @Override
public Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam) { public Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam, String language) {
Page<StrokeQueryVo> page = new PageInfo<>(mcStrokePageParam); Page<StrokeQueryVo> page = new PageInfo<>(mcStrokePageParam);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
IPage<McStrokeQueryVo> mcStrokePageList = strokeMapper.getMcStrokePageList(page, mcStrokePageParam, jwtToken.getMcId()); IPage<McStrokeQueryVo> mcStrokePageList = strokeMapper.getMcStrokePageList(page, mcStrokePageParam, jwtToken.getMcId(), language);
return new Paging<McStrokeQueryVo>(mcStrokePageList); return new Paging<McStrokeQueryVo>(mcStrokePageList);
} }
...@@ -125,4 +135,57 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp ...@@ -125,4 +135,57 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
IPage<McStrokePaymentQueryVo> mcStrokePageList = strokeMapper.getPaymentPageList(page, mcStrokePaymentPageParam, jwtToken.getMcId()); IPage<McStrokePaymentQueryVo> mcStrokePageList = strokeMapper.getPaymentPageList(page, mcStrokePaymentPageParam, jwtToken.getMcId());
return new Paging<McStrokePaymentQueryVo>(mcStrokePageList); return new Paging<McStrokePaymentQueryVo>(mcStrokePageList);
} }
@Transactional(rollbackFor = Exception.class)
@Override
public ApiResult<Boolean> quotedPrice(StrokeQuotedPriceParam strokeQuotedPriceParam) throws Exception {
//先判断商家机型是否空闲
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
McPlain mcPlain = mcPlainService.getOne(new QueryWrapper<McPlain>().lambda()
.eq(McPlain::getPtId, strokeQuotedPriceParam.getPlainTypeId())
.eq(McPlain::getMcId, jwtToken.getMcId())
.gt(McPlain::getIdleNum, 0)
.eq(McPlain::getStatus, 0)
);
if (mcPlain == null) {
return ApiResult.result(ApiCode.MC_PLANE_NOT_AVAILABLE, false);
}
Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeQuotedPriceParam, stroke);
stroke.setUpdateTime(new Timestamp(System.currentTimeMillis()));
boolean flag = this.updateStroke(stroke);
if (flag) {
//报价完成后,商家飞机表空闲数量-1
McPlain newMcPlain = new McPlain();
newMcPlain.setId(mcPlain.getId())
.setIdleNum((mcPlain.getIdleNum() - 1) >= 0 ? (mcPlain.getIdleNum() - 1) : 0);
flag = mcPlainService.updateMcPlain(newMcPlain);
}
return ApiResult.result(flag);
}
@Override
public ApiResult<Boolean> completeStroke(StrokeCompleteParam strokeCompleteParam) throws Exception {
Stroke stroke = new Stroke();
stroke.setId(strokeCompleteParam.getId())
.setUpdateTime(new Timestamp(System.currentTimeMillis()))
.setStatus(StrokeStatusEnum.COMPLETED.getCode());
boolean flag = this.updateStroke(stroke);
Stroke newStroke = this.getById(strokeCompleteParam.getId());
//先判断商家机型是否存在
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
McPlain mcPlain = mcPlainService.getOne(new QueryWrapper<McPlain>().lambda()
.eq(McPlain::getPtId, newStroke.getPlainTypeId())
.eq(McPlain::getMcId, jwtToken.getMcId())
);
if (mcPlain != null) {
//行程完成后需要给商家飞机空闲数量+1
McPlain newMcPlain = new McPlain();
newMcPlain.setId(mcPlain.getId())
.setIdleNum((mcPlain.getIdleNum() + 1) > newMcPlain.getAmount() ? newMcPlain.getAmount()
: (mcPlain.getIdleNum() + 1));
flag = mcPlainService.updateMcPlain(newMcPlain);
}
return ApiResult.result(flag);
}
} }
...@@ -130,7 +130,6 @@ public class StrokeDetailVo implements Serializable { ...@@ -130,7 +130,6 @@ public class StrokeDetailVo implements Serializable {
@ApiModelProperty("用户选择机型") @ApiModelProperty("用户选择机型")
private Long choosePlainType; private Long choosePlainType;
@NotBlank(message = "出发机场名称不能为空") @NotBlank(message = "出发机场名称不能为空")
@ApiModelProperty("出发机场名称") @ApiModelProperty("出发机场名称")
private String outsetAirportName; private String outsetAirportName;
...@@ -139,18 +138,6 @@ public class StrokeDetailVo implements Serializable { ...@@ -139,18 +138,6 @@ public class StrokeDetailVo implements Serializable {
@ApiModelProperty("到达机场名称") @ApiModelProperty("到达机场名称")
private String arriveAirportName; private String arriveAirportName;
@NotNull(message = "返程飞机型号ID为空")
@ApiModelProperty("返程飞机型号ID")
private Long arrivePlainTypeId;
@NotBlank(message = "返程出发机场名称不能为空")
@ApiModelProperty("返程出发机场名称")
private String backOutsetAirportName;
@NotBlank(message = "返程到达机场名称不能为空")
@ApiModelProperty("返程到达机场名称")
private String backArriveAirportName;
@ApiModelProperty("商家名称") @ApiModelProperty("商家名称")
private String merchantName; private String merchantName;
......
...@@ -37,6 +37,9 @@ public class StrokeQueryVo implements Serializable { ...@@ -37,6 +37,9 @@ public class StrokeQueryVo implements Serializable {
@ApiModelProperty("到达城市名称") @ApiModelProperty("到达城市名称")
private String cityArriveName; private String cityArriveName;
@ApiModelProperty("飞机型号名称")
private String plainTypeName;
@ApiModelProperty("出发时间") @ApiModelProperty("出发时间")
private Timestamp outsetTime; private Timestamp outsetTime;
...@@ -66,18 +69,6 @@ public class StrokeQueryVo implements Serializable { ...@@ -66,18 +69,6 @@ public class StrokeQueryVo implements Serializable {
@ApiModelProperty("到达机场名称") @ApiModelProperty("到达机场名称")
private String arriveAirportName; private String arriveAirportName;
@NotNull(message = "返程飞机型号ID为空")
@ApiModelProperty("返程飞机型号ID")
private Long arrivePlainTypeId;
// @NotBlank(message = "返程出发机场名称不能为空")
// @ApiModelProperty("返程出发机场名称")
// private String backOutsetAirportName;
//
// @NotBlank(message = "返程到达机场名称不能为空")
// @ApiModelProperty("返程到达机场名称")
// private String backArriveAirportName;
@NotNull(message = "付款状态不能为空") @NotNull(message = "付款状态不能为空")
@ApiModelProperty("付款状态,0-未付款,1-付款中,2-已付款,3-退款中,99-已退款") @ApiModelProperty("付款状态,0-未付款,1-付款中,2-已付款,3-退款中,99-已退款")
private Integer paymentStatus; private Integer paymentStatus;
......
...@@ -19,5 +19,13 @@ ...@@ -19,5 +19,13 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from plain_type from plain_type
</select> </select>
<select id="getAppPlainTypePageList" resultType="com.jumeirah.common.entity.PlainType">
SELECT
pt.*
FROM
( SELECT DISTINCT mp.pt_id FROM mc_plain mp WHERE mp.idle_num > 0 AND `status` = 0 ) a
LEFT JOIN plain_type pt ON pt.id = a.pt_id
WHERE pt.`status`= 0
</select>
</mapper> </mapper>
...@@ -6,26 +6,23 @@ ...@@ -6,26 +6,23 @@
<sql id="Page_Column_List"> <sql id="Page_Column_List">
s.id, s.id,
mu.id as merchantId, mu.id as merchantId,
city_outset_id, s.city_outset_id,
city_arrive_id, s.city_arrive_id,
people_num, s.people_num,
plain_type_id, s.plain_type_id,
outset_time, s.outset_time,
return_time, s.return_time,
type, s.type,
STATUS, s.status,
money, s.money,
user_id, s.user_id,
mu.username AS merchantName, mu.username AS merchantName,
arrive_plain_type_id, s.payment_status,
back_outset_airport_name, s.audit_status,
back_arrive_airport_name, s.user_recharge_bank,
payment_status, s.user_recharge_name,
audit_status, s.is_discount,
user_recharge_bank, s.user_recharge_bank_number
user_recharge_name,
is_discount,
user_recharge_bank_number
</sql> </sql>
...@@ -55,9 +52,6 @@ ...@@ -55,9 +52,6 @@
user_id, user_id,
outset_airport_name, outset_airport_name,
arrive_airport_name, arrive_airport_name,
arrive_plain_type_id,
back_outset_airport_name,
back_arrive_airport_name,
payment_status,audit_status, payment_status,audit_status,
user_recharge_money, user_recharge_money,
user_recharge_bank, user_recharge_bank,
...@@ -90,11 +84,13 @@ ...@@ -90,11 +84,13 @@
ctca.airport_name_cn as arrive_airport_name, ctca.airport_name_cn as arrive_airport_name,
</otherwise> </otherwise>
</choose> </choose>
pt.name as plain_type_name,
<include refid="Page_Column_List"/> <include refid="Page_Column_List"/>
from stroke s from stroke s
INNER JOIN merchant_user mu ON mu.id = s.mc_id INNER JOIN merchant_user mu ON mu.id = s.mc_id
INNER JOIN city_three_code ctco ON ctco.id = s.city_outset_id INNER JOIN city_three_code ctco ON ctco.id = s.city_outset_id
INNER JOIN city_three_code ctca ON ctca.id = s.city_arrive_id INNER JOIN city_three_code ctca ON ctca.id = s.city_arrive_id
INNER JOIN plain_type pt ON pt.id = s.plain_type_id
<where> <where>
and s.user_id = #{userId} and s.user_id = #{userId}
and s.deleted = 0 and s.deleted = 0
...@@ -125,11 +121,13 @@ ...@@ -125,11 +121,13 @@
ctca.airport_name_cn as arrive_airport_name, ctca.airport_name_cn as arrive_airport_name,
</otherwise> </otherwise>
</choose> </choose>
pt.name as plain_type_name,
<include refid="Page_Column_List"/> <include refid="Page_Column_List"/>
from stroke s from stroke s
INNER JOIN merchant_user mu ON mu.id = s.mc_id INNER JOIN merchant_user mu ON mu.id = s.mc_id
INNER JOIN city_three_code ctco ON ctco.id = s.city_outset_id INNER JOIN city_three_code ctco ON ctco.id = s.city_outset_id
INNER JOIN city_three_code ctca ON ctca.id = s.city_arrive_id INNER JOIN city_three_code ctca ON ctca.id = s.city_arrive_id
INNER JOIN plain_type pt ON pt.id = s.plain_type_id
<where> <where>
and s.user_id = #{userId} and s.user_id = #{userId}
and s.deleted = 0 and s.deleted = 0
...@@ -162,9 +160,6 @@ ...@@ -162,9 +160,6 @@
s.remarks, s.remarks,
s.money, s.money,
s.user_id, s.user_id,
s.arrive_plain_type_id,
s.back_outset_airport_name,
s.back_arrive_airport_name,
s.choose_plain_type, s.choose_plain_type,
s.payment_status, s.payment_status,
s.audit_status, s.audit_status,
...@@ -176,10 +171,20 @@ ...@@ -176,10 +171,20 @@
s.user_recharge_time, s.user_recharge_time,
s.is_discount, s.is_discount,
s.payment_channel, s.payment_channel,
<choose>
<when test="language !='zh_CN'">
ctco.city_name_en as city_outset_name,
ctco.airport_name_en as outset_airport_name,
ctca.city_name_en as city_arrive_name,
ctca.airport_name_en as arrive_airport_name,
</when>
<otherwise>
ctco.city_name_cn as city_outset_name, ctco.city_name_cn as city_outset_name,
ctco.airport_name_cn as outset_airport_name, ctco.airport_name_cn as outset_airport_name,
ctca.city_name_cn as city_arrive_name, ctca.city_name_cn as city_arrive_name,
ctca.airport_name_cn as arrive_airport_name, ctca.airport_name_cn as arrive_airport_name,
</otherwise>
</choose>
CONCAT( au.surname, au.name) AS applicant, CONCAT( au.surname, au.name) AS applicant,
pt.name AS plain_type_name, pt.name AS plain_type_name,
au.phone AS phone_number au.phone AS phone_number
...@@ -270,9 +275,6 @@ ...@@ -270,9 +275,6 @@
s.remarks, s.remarks,
s.money, s.money,
s.user_id, s.user_id,
s.arrive_plain_type_id,
s.back_outset_airport_name,
s.back_arrive_airport_name,
s.payment_status, s.payment_status,
s.audit_status, s.audit_status,
s.user_recharge_money, s.user_recharge_money,
......
...@@ -79,3 +79,5 @@ api.response.code.user.PWD_OR_USERNAME_ERROR=password or phone number error ...@@ -79,3 +79,5 @@ api.response.code.user.PWD_OR_USERNAME_ERROR=password or phone number error
api.response.code.user.SMS_CODE_ERROR=sms code error api.response.code.user.SMS_CODE_ERROR=sms code error
api.response.code.user.USER_NOT_FOUND=user not found api.response.code.user.USER_NOT_FOUND=user not found
api.response.code.user.PLAIN_TYPE_NOT_FOUND=plain type not found api.response.code.user.PLAIN_TYPE_NOT_FOUND=plain type not found
api.response.code.user.MC_PLANE_NOT_AVAILABLE=This type of aircraft is not available
api.response.code.user.MC_PLANE_EXISTED=This aircraft already exists
...@@ -79,3 +79,5 @@ api.response.code.user.PWD_OR_USERNAME_ERROR=账号或密码错误 ...@@ -79,3 +79,5 @@ api.response.code.user.PWD_OR_USERNAME_ERROR=账号或密码错误
api.response.code.user.SMS_CODE_ERROR=验证码错误 api.response.code.user.SMS_CODE_ERROR=验证码错误
api.response.code.user.USER_NOT_FOUND=用户不存在 api.response.code.user.USER_NOT_FOUND=用户不存在
api.response.code.user.PLAIN_TYPE_NOT_FOUND=飞机类型不存在 api.response.code.user.PLAIN_TYPE_NOT_FOUND=飞机类型不存在
api.response.code.user.MC_PLANE_NOT_AVAILABLE=此机型飞机暂无空闲
api.response.code.user.MC_PLANE_EXISTED=商家此机型飞机已存在
...@@ -24,8 +24,6 @@ public class Stroke implements Serializable { ...@@ -24,8 +24,6 @@ public class Stroke implements Serializable {
private Long mcId; private Long mcId;
private String outsetAirportName;//出发机场名称 private String outsetAirportName;//出发机场名称
private String arriveAirportName;//到达机场名称 private String arriveAirportName;//到达机场名称
private String backOutsetAirportName;//返程出发机场名称
private String backArriveAirportName;//返程到达机场名称
private boolean isDiscount;//是否是优惠调机 private boolean isDiscount;//是否是优惠调机
} }
...@@ -121,6 +121,14 @@ public enum ApiCode { ...@@ -121,6 +121,14 @@ public enum ApiCode {
* 飞机类型不存在 * 飞机类型不存在
*/ */
PLAIN_TYPE_NOT_FOUND(6004, "api.response.code.user.PLAIN_TYPE_NOT_FOUND"), PLAIN_TYPE_NOT_FOUND(6004, "api.response.code.user.PLAIN_TYPE_NOT_FOUND"),
/**
* 此机型飞机暂无空闲
*/
MC_PLANE_NOT_AVAILABLE(6005, "api.response.code.user.MC_PLANE_NOT_AVAILABLE"),
/**
* 商家此机型飞机已存在
*/
MC_PLANE_EXISTED(6006, "api.response.code.user.MC_PLANE_EXISTED"),
; ;
private final int code; private final int code;
......
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