Commit be4059d0 by zhangjw

Merge branch 'master' of http://119.28.51.83/hewei/Jumeirah into Jw

parents 3eed56ed 126cfe3a
......@@ -41,13 +41,13 @@ public class PlainTypeController extends BaseController {
private PlainTypeService plainTypeService;
/**
* 飞机型号表分页列表
* app端飞机型号表分页列表
*/
@GetMapping("/getAllMap")
@OperationLog(name = "分组获取飞机型号列表", type = OperationLogType.PAGE)
@ApiOperation(value = "分组获取飞机型号列表", response = PlainTypeQueryVo.class)
public ApiResult<List<PlainTypeBo>> getAllMap() throws Exception {
List<PlainType> plainTypeList = plainTypeService.getAllMap();
List<PlainType> plainTypeList = plainTypeService.getAppPlainTypePageList();
Map<Integer, List<PlainType>> resultMap;
List<PlainTypeBo> plainTypeBoList = new ArrayList<>();
if (!CollectionUtils.isEmpty(plainTypeList)) {
......
......@@ -56,6 +56,7 @@ public class SysNoticeController extends BaseController {
sysNoticeQueryVo.setTheme(sysNotice.getTheme());
sysNoticeQueryVo.setMsgInfo(sysNotice.getContent());
sysNoticeQueryVo.setSendTime(sysNotice.getCreateTime());
sysNoticeQueryVoList.add(sysNoticeQueryVo);
}
// 修改为已读
......@@ -64,7 +65,12 @@ public class SysNoticeController extends BaseController {
if (sysNoticeRead != null) {
sysNoticeRead.setReadStatus(1);
sysNoticeReadService.updateById(sysNoticeRead);
}
} /*else {
SysNoticeRead sysNoticeRead1 = new SysNoticeRead();
sysNoticeRead1.setUserId(jwtToken.getUserId());
sysNoticeRead1.setReadStatus(1);
sysNoticeReadService.save(sysNoticeRead1);
}*/
return ApiResult.ok(sysNoticeQueryVoList);
}
......
package com.jumeirah.api.app.entity.param;
import com.jumeirah.common.entity.base.ImgJson;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -10,6 +11,7 @@ import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
import java.util.List;
/**
* 行程表
......@@ -40,9 +42,8 @@ public class StrokeAddMedicalTreatmentParam extends BaseEntity {
@ApiModelProperty("病人疾病名称")
private String diseaseName;
@NotBlank(message = "病人病情诊断书不能为空")
@ApiModelProperty("病人病情诊断书")
private String medicalCertificateUrl;
private List<ImgJson> medicalCertificateUrl;
@ApiModelProperty("配备器械(格式:1,2,3)逗号分隔")
private String instruments;
......
......@@ -31,6 +31,14 @@ public interface AppUserApiService {
*/
boolean updateAppUser(AppUserInfoParam appUserInfoParam) throws Exception;
/**
* 修改手机号
* @param phoneArea
* @param phone
* @param code
* @return
* @throws Exception
*/
ApiResult<Boolean> updatePhone(String phoneArea, String phone, String code) throws Exception;
......
......@@ -44,6 +44,15 @@ public class AppUserApiServiceImpl implements AppUserApiService {
// 删除已使用的验证码
appSmsService.deleteUpdatePhoneCode(appUserById.getPhoneArea(), appUserById.getPhone());
// 判断手机号是否已经注册
AppUser one = appUserService.getOne(new QueryWrapper<AppUser>().lambda()
.eq(AppUser::getPhoneArea, phoneArea)
.eq(AppUser::getPhone, phone));
if (one != null) {
return ApiResult.fail(ApiCode.BUSINESS_EXCEPTION);
}
AppUser appUser = new AppUser();
appUser.setPhoneArea(phoneArea);
appUser.setPhone(phone);
......
......@@ -48,5 +48,16 @@ public class McPlainTypeController extends BaseController {
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;
import com.jumeirah.api.merchant.entity.param.StrokeCompleteParam;
import com.jumeirah.api.merchant.entity.param.StrokeConfirmPaymentParam;
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.Stroke;
import com.jumeirah.common.enums.StatePaymentStatusEnum;
import com.jumeirah.common.enums.StrokeStatusEnum;
import com.jumeirah.common.factory.PushFactory;
import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.StrokeCompleteParam;
import com.jumeirah.common.param.StrokeQuotedPriceParam;
import com.jumeirah.common.service.AppUserService;
import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.vo.McStrokeQueryVo;
import com.jumeirah.common.vo.StrokeDetailVo;
import io.geekidea.springbootplus.framework.common.api.ApiCode;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
......@@ -19,11 +24,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
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.RestController;
......@@ -43,6 +48,10 @@ public class McStrokeController extends BaseController {
@Autowired
private StrokeService strokeService;
@Autowired
private PushFactory pushFactory;
@Autowired
private AppUserService appUserService;
/**
* 完成行程接口
......@@ -52,12 +61,25 @@ public class McStrokeController extends BaseController {
@ApiOperation(value = "完成行程接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> completeStroke(@Validated @RequestBody StrokeCompleteParam strokeCompleteParam) throws Exception {
Stroke stroke = new Stroke();
stroke.setId(strokeCompleteParam.getId())
.setUpdateTime(new Timestamp(System.currentTimeMillis()))
.setStatus(StrokeStatusEnum.COMPLETED.getCode());
boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag);
ApiResult<Boolean> result = strokeService.completeStroke(strokeCompleteParam);
if (result.getCode() == ApiCode.SUCCESS.getCode()) {
sendAppMsg(strokeCompleteParam.getId(), "3", "您的订单已完成");
}
return result;
}
/**
* 发送推送信息给APP端
*
* @param id
* @param pushType
* @param title
* @throws Exception
*/
private void sendAppMsg(Long id, String pushType, String title) throws Exception {
StrokeDetailVo newStroke = strokeService.getStrokeById(id);
AppUser appUser = appUserService.getById(newStroke.getUserId());
pushFactory.getService(appUser.getDeviceType()).unicast(appUser.getDeviceToken(), pushType, title);
}
/**
......@@ -67,8 +89,8 @@ public class McStrokeController extends BaseController {
@OperationLog(name = "行程分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程分页列表")
@RequiresPermissions("merchant:order:view")
public ApiResult<Paging<McStrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody McStrokePageParam mcStrokePageParam) throws Exception {
Paging<McStrokeQueryVo> paging = strokeService.getMcStrokePageList(mcStrokePageParam);
public ApiResult<Paging<McStrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody McStrokePageParam mcStrokePageParam, @RequestHeader(required = false) String language) throws Exception {
Paging<McStrokeQueryVo> paging = strokeService.getMcStrokePageList(mcStrokePageParam, language);
return ApiResult.ok(paging);
}
......@@ -80,11 +102,11 @@ public class McStrokeController extends BaseController {
@ApiOperation(value = "行程报价接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> updateStroke(@Validated @RequestBody StrokeQuotedPriceParam strokeQuotedPriceParam) throws Exception {
Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeQuotedPriceParam, stroke);
stroke.setUpdateTime(new Timestamp(System.currentTimeMillis()));
boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag);
ApiResult<Boolean> result = strokeService.quotedPrice(strokeQuotedPriceParam);
if (result.getCode() == ApiCode.SUCCESS.getCode()) {
sendAppMsg(strokeQuotedPriceParam.getId(), "2", "您的订单已报价");
}
return result;
}
/**
......
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.common.entity.McPlain;
import com.jumeirah.common.entity.PlainType;
......@@ -60,10 +61,15 @@ public class McPlainController extends BaseController {
if (checkPtId(mcPlainAddParam)) {
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();
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);
return ApiResult.result(flag);
}
......@@ -87,12 +93,41 @@ public class McPlainController extends BaseController {
if (checkPtId(mcPlainAddParam)) {
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();
BeanUtils.copyProperties(mcPlainAddParam, mcPlain);
mcPlain.setIdleNum(idleNum);
boolean flag = mcPlainService.updateMcPlain(mcPlain);
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 {
@ApiModelProperty("所在地城市ID")
private Long cityId;
@ApiModelProperty("空闲数量")
private Integer idleNum;
}
package com.jumeirah.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.jumeirah.common.entity.base.ImgJson;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
......@@ -15,6 +19,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
/**
* 行程表
......@@ -26,6 +31,7 @@ import java.sql.Timestamp;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Stroke对象")
@TableName(autoResultMap = true)
public class Stroke extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -96,8 +102,9 @@ public class Stroke extends BaseEntity {
@ApiModelProperty("病人疾病名称")
private String diseaseName;
@TableField(typeHandler = FastjsonTypeHandler.class)
@ApiModelProperty("病人病情诊断书")
private String medicalCertificateUrl;
private List<ImgJson> medicalCertificateUrl;
@ApiModelProperty("配备器械(格式:1,2,3)逗号分隔")
private String instruments;
......@@ -123,18 +130,6 @@ public class Stroke extends BaseEntity {
@ApiModelProperty("到达机场名称")
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不能为空")
@ApiModelProperty("商家id")
private Long mcId;
......
......@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable;
import java.util.List;
/**
* 飞机型号表 Mapper 接口
......@@ -39,4 +40,10 @@ public interface PlainTypeMapper extends BaseMapper<PlainType> {
*/
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> {
* @param page
* @param mcStrokePageParam
* @param mcId
* @param language
* @return
*/
IPage<McStrokeQueryVo> getMcStrokePageList(
@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> {
* @param id
* @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.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.swagger.annotations.ApiModel;
......
......@@ -66,4 +66,11 @@ public interface PlainTypeService extends BaseService<PlainType> {
* @return
*/
List<PlainType> getAllMap();
/**
* 飞机型号表分页列表
* @return
*/
List<PlainType> getAppPlainTypePageList();
}
......@@ -3,11 +3,14 @@ package com.jumeirah.common.service;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.McStrokePaymentPageParam;
import com.jumeirah.common.param.StrokeCompleteParam;
import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.param.StrokeQuotedPriceParam;
import com.jumeirah.common.vo.McStrokePaymentQueryVo;
import com.jumeirah.common.vo.McStrokeQueryVo;
import com.jumeirah.common.vo.StrokeDetailVo;
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.core.pagination.Paging;
......@@ -73,9 +76,10 @@ public interface StrokeService extends BaseService<Stroke> {
* 商家端,分页获取行程接口
*
* @param mcStrokePageParam
* @param language
* @return
*/
Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam);
Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam, String language);
/**
* 收款记录
......@@ -84,4 +88,18 @@ public interface StrokeService extends BaseService<Stroke> {
* @return
*/
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
);
}
@Override
public List<PlainType> getAppPlainTypePageList() {
return plainTypeMapper.getAppPlainTypePageList();
}
}
package com.jumeirah.common.service.impl;
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.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.enums.StrokeStatusEnum;
import com.jumeirah.common.mapper.StrokeMapper;
import com.jumeirah.common.mq.Queue;
import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.McStrokePaymentPageParam;
import com.jumeirah.common.param.StrokeCompleteParam;
import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.param.StrokeQuotedPriceParam;
import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.vo.McStrokePaymentQueryVo;
import com.jumeirah.common.vo.McStrokeQueryVo;
import com.jumeirah.common.vo.StrokeDetailVo;
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.core.pagination.PageInfo;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Timestamp;
/**
* 行程表 服务实现类
*
......@@ -41,6 +49,8 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
@Autowired
private StrokeMapper strokeMapper;
@Autowired
private McPlainServiceImpl mcPlainService;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -99,7 +109,7 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
@Override
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.desc("s.create_time"));
Page<StrokeQueryVo> page = new PageInfo<>(strokePageParam);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
// 查询已完成 需要额外查询已取消状态
if (strokePageParam.getStatus().equals(StrokeStatusEnum.COMPLETED.getCode())) {
......@@ -111,10 +121,10 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
}
@Override
public Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam) {
public Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam, String language) {
Page<StrokeQueryVo> page = new PageInfo<>(mcStrokePageParam);
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);
}
......@@ -125,4 +135,57 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
IPage<McStrokePaymentQueryVo> mcStrokePageList = strokeMapper.getPaymentPageList(page, mcStrokePaymentPageParam, jwtToken.getMcId());
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);
}
}
package com.jumeirah.common.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.jumeirah.common.entity.base.ImgJson;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -14,6 +18,7 @@ import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
/**
* <pre>
......@@ -26,6 +31,7 @@ import java.sql.Timestamp;
@Data
@Accessors(chain = true)
@ApiModel(value = "StrokeDetailVo对象")
@TableName(autoResultMap = true)
public class StrokeDetailVo implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -96,8 +102,9 @@ public class StrokeDetailVo implements Serializable {
@ApiModelProperty("病人疾病名称")
private String diseaseName;
@TableField(typeHandler = FastjsonTypeHandler.class)
@ApiModelProperty("病人病情诊断书")
private String medicalCertificateUrl;
private List<ImgJson> medicalCertificateUrl;
@ApiModelProperty("配备器械(格式:1,2,3)逗号分隔")
private String instruments;
......@@ -123,7 +130,6 @@ public class StrokeDetailVo implements Serializable {
@ApiModelProperty("用户选择机型")
private Long choosePlainType;
@NotBlank(message = "出发机场名称不能为空")
@ApiModelProperty("出发机场名称")
private String outsetAirportName;
......@@ -132,18 +138,6 @@ public class StrokeDetailVo implements Serializable {
@ApiModelProperty("到达机场名称")
private String arriveAirportName;
@NotNull(message = "返程飞机型号ID为空")
@ApiModelProperty("返程飞机型号ID")
private Long arrivePlainTypeId;
@NotBlank(message = "返程出发机场名称不能为空")
@ApiModelProperty("返程出发机场名称")
private String backOutsetAirportName;
@NotBlank(message = "返程到达机场名称不能为空")
@ApiModelProperty("返程到达机场名称")
private String backArriveAirportName;
@ApiModelProperty("商家名称")
private String merchantName;
......
......@@ -37,6 +37,9 @@ public class StrokeQueryVo implements Serializable {
@ApiModelProperty("到达城市名称")
private String cityArriveName;
@ApiModelProperty("飞机型号名称")
private String plainTypeName;
@ApiModelProperty("出发时间")
private Timestamp outsetTime;
......@@ -66,18 +69,6 @@ public class StrokeQueryVo implements Serializable {
@ApiModelProperty("到达机场名称")
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 = "付款状态不能为空")
@ApiModelProperty("付款状态,0-未付款,1-付款中,2-已付款,3-退款中,99-已退款")
private Integer paymentStatus;
......
......@@ -19,5 +19,13 @@
<include refid="Base_Column_List"/>
from plain_type
</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>
......@@ -6,26 +6,23 @@
<sql id="Page_Column_List">
s.id,
mu.id as merchantId,
city_outset_id,
city_arrive_id,
people_num,
plain_type_id,
outset_time,
return_time,
type,
STATUS,
money,
user_id,
s.city_outset_id,
s.city_arrive_id,
s.people_num,
s.plain_type_id,
s.outset_time,
s.return_time,
s.type,
s.status,
s.money,
s.user_id,
mu.username AS merchantName,
arrive_plain_type_id,
back_outset_airport_name,
back_arrive_airport_name,
payment_status,
audit_status,
user_recharge_bank,
user_recharge_name,
is_discount,
user_recharge_bank_number
s.payment_status,
s.audit_status,
s.user_recharge_bank,
s.user_recharge_name,
s.is_discount,
s.user_recharge_bank_number
</sql>
......@@ -55,9 +52,6 @@
user_id,
outset_airport_name,
arrive_airport_name,
arrive_plain_type_id,
back_outset_airport_name,
back_arrive_airport_name,
payment_status,audit_status,
user_recharge_money,
user_recharge_bank,
......@@ -90,11 +84,13 @@
ctca.airport_name_cn as arrive_airport_name,
</otherwise>
</choose>
pt.name as plain_type_name,
<include refid="Page_Column_List"/>
from stroke s
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 ctca ON ctca.id = s.city_arrive_id
INNER JOIN plain_type pt ON pt.id = s.plain_type_id
<where>
and s.user_id = #{userId}
and s.deleted = 0
......@@ -125,16 +121,17 @@
ctca.airport_name_cn as arrive_airport_name,
</otherwise>
</choose>
pt.name as plain_type_name,
<include refid="Page_Column_List"/>
from stroke s
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 ctca ON ctca.id = s.city_arrive_id
INNER JOIN plain_type pt ON pt.id = s.plain_type_id
<where>
and s.user_id = #{userId}
and s.deleted = 0
and s.`status` = #{param.status}
or s.`status` = 99
AND s.`status` IN (#{param.status},99)
</where>
</select>
......@@ -163,9 +160,6 @@
s.remarks,
s.money,
s.user_id,
s.arrive_plain_type_id,
s.back_outset_airport_name,
s.back_arrive_airport_name,
s.choose_plain_type,
s.payment_status,
s.audit_status,
......@@ -177,10 +171,20 @@
s.user_recharge_time,
s.is_discount,
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.airport_name_cn as outset_airport_name,
ctca.city_name_cn as city_arrive_name,
ctca.airport_name_cn as arrive_airport_name,
</otherwise>
</choose>
CONCAT( au.surname, au.name) AS applicant,
pt.name AS plain_type_name,
au.phone AS phone_number
......@@ -271,9 +275,6 @@
s.remarks,
s.money,
s.user_id,
s.arrive_plain_type_id,
s.back_outset_airport_name,
s.back_arrive_airport_name,
s.payment_status,
s.audit_status,
s.user_recharge_money,
......
......@@ -187,6 +187,7 @@ spring-boot-plus:
- /sys/login,/sys/logout,/sys/register
- /merchant/user/login,/merchant/user/register
- /app/sms/registerOrLoginCode,/merchant/sms/registerCode
- /app/versionControl/lastOne/**
# 排除静态资源
- /static/**,/templates/**
# 排除Swagger
......
......@@ -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.USER_NOT_FOUND=user 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=账号或密码错误
api.response.code.user.SMS_CODE_ERROR=验证码错误
api.response.code.user.USER_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 {
private Long mcId;
private String outsetAirportName;//出发机场名称
private String arriveAirportName;//到达机场名称
private String backOutsetAirportName;//返程出发机场名称
private String backArriveAirportName;//返程到达机场名称
private boolean isDiscount;//是否是优惠调机
}
......@@ -121,6 +121,14 @@ public enum ApiCode {
* 飞机类型不存在
*/
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;
......
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