Commit 68996601 by testdl

# 用户下单功能

parent dc832002
package com.jumeirah.common.controller;
package com.jumeirah.api.app.controller;
import cn.hutool.core.date.DateUtil;
import com.jumeirah.api.app.entity.vo.StrokeAddBackAndForthVo;
import com.jumeirah.api.app.entity.vo.StrokeAddFreightVo;
import com.jumeirah.api.app.entity.vo.StrokeAddMedicalTreatmentVo;
import com.jumeirah.api.app.entity.vo.StrokeAddOneWayVo;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.service.StrokeService;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import lombok.extern.slf4j.Slf4j;
import com.jumeirah.common.param.StrokePageParam;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.common.param.IdParam;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.jumeirah.common.param.StrokePageParam;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.common.param.IdParam;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -31,65 +39,120 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/stroke")
@Module("${cfg.module}")
@Api(value = "行程表API", tags = {"行程表"})
public class StrokeController extends BaseController {
public class StrokeController extends BaseController {
@Autowired
private StrokeService strokeService;
@Autowired
private StrokeService strokeService;
/**
* 添加行程表
* 添加单程行程表
*/
@PostMapping("/add")
@OperationLog(name = "添加行程表", type = OperationLogType.ADD)
@ApiOperation(value = "添加行程表", response = ApiResult.class)
public ApiResult<Boolean> addStroke(@Validated(Add.class) @RequestBody Stroke stroke)throws Exception{
boolean flag= strokeService.saveStroke(stroke);
return ApiResult.result(flag);
}
@PostMapping("/add/oneWay")
@OperationLog(name = "添加单程行程表", type = OperationLogType.ADD)
@ApiOperation(value = "添加单程行程表", response = ApiResult.class)
public ApiResult<Boolean> addOneWayStroke(@Validated @RequestBody StrokeAddOneWayVo strokeAddOneWayVo) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeAddOneWayVo, stroke);
stroke.setType(0)
.setCreateTime(System.currentTimeMillis());
boolean flag = strokeService.saveStroke(stroke);
return ApiResult.result(flag);
}
/**
* 添加往返行程表
*/
@PostMapping("/add/backAndForth")
@OperationLog(name = "添加往返行程表", type = OperationLogType.ADD)
@ApiOperation(value = "添加往返行程表", response = ApiResult.class)
public ApiResult<Boolean> addBackAndForthStroke(@Validated @RequestBody StrokeAddBackAndForthVo strokeAddBackAndForthVo) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeAddBackAndForthVo, stroke);
stroke.setType(1)
.setCreateTime(System.currentTimeMillis());
boolean flag = strokeService.saveStroke(stroke);
return ApiResult.result(flag);
}
/**
* 添加货运行程表
*/
@PostMapping("/add/freight")
@OperationLog(name = "添加货运行程表", type = OperationLogType.ADD)
@ApiOperation(value = "添加货运行程表", response = ApiResult.class)
public ApiResult<Boolean> addFreightStroke(@Validated @RequestBody StrokeAddFreightVo strokeAddFreightVo) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeAddFreightVo, stroke);
stroke.setType(2)
.setCreateTime(System.currentTimeMillis());
boolean flag = strokeService.saveStroke(stroke);
return ApiResult.result(flag);
}
/**
* 添加医疗行程表
*/
@PostMapping("/add/medicalTreatment")
@OperationLog(name = "添加医疗行程表", type = OperationLogType.ADD)
@ApiOperation(value = "添加医疗行程表", response = ApiResult.class)
public ApiResult<Boolean> addMedicalTreatmentStroke(
@Validated @RequestBody StrokeAddMedicalTreatmentVo strokeAddMedicalTreatmentVo) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeAddMedicalTreatmentVo, stroke);
stroke.setType(3)
.setCreateTime(System.currentTimeMillis());
boolean flag = strokeService.saveStroke(stroke);
return ApiResult.result(flag);
}
/**
* 修改行程表
*/
@PostMapping("/update")
@OperationLog(name = "修改行程表", type = OperationLogType.UPDATE)
@OperationLog(name = "修改行程表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改行程表", response = ApiResult.class)
public ApiResult<Boolean> updateStroke(@Validated(Update.class) @RequestBody Stroke stroke)throws Exception{
boolean flag= strokeService.updateStroke(stroke);
return ApiResult.result(flag);
}
public ApiResult<Boolean> updateStroke(@Validated(Update.class) @RequestBody Stroke stroke) throws Exception {
boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag);
}
/**
* 删除行程表
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除行程表", type = OperationLogType.DELETE)
@OperationLog(name = "删除行程表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除行程表", response = ApiResult.class)
public ApiResult<Boolean> deleteStroke(@PathVariable("id") Long id)throws Exception{
boolean flag= strokeService.deleteStroke(id);
return ApiResult.result(flag);
}
public ApiResult<Boolean> deleteStroke(@PathVariable("id") Long id) throws Exception {
boolean flag = strokeService.deleteStroke(id);
return ApiResult.result(flag);
}
/**
* 获取行程表详情
*/
@GetMapping("/info/{id}")
@OperationLog(name = "行程表详情", type = OperationLogType.INFO)
@OperationLog(name = "行程表详情", type = OperationLogType.INFO)
@ApiOperation(value = "行程表详情", response = StrokeQueryVo.class)
public ApiResult<StrokeQueryVo> getStroke(@PathVariable("id") Long id)throws Exception{
StrokeQueryVo strokeQueryVo = strokeService.getStrokeById(id);
return ApiResult.ok(strokeQueryVo);
}
public ApiResult<StrokeQueryVo> getStroke(@PathVariable("id") Long id) throws Exception {
StrokeQueryVo strokeQueryVo = strokeService.getStrokeById(id);
return ApiResult.ok(strokeQueryVo);
}
/**
* 行程表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "行程表分页列表", type = OperationLogType.PAGE)
@OperationLog(name = "行程表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程表分页列表", response = StrokeQueryVo.class)
public ApiResult<Paging<StrokeQueryVo>>getStrokePageList(@Validated @RequestBody StrokePageParam strokePageParam)throws Exception{
Paging<StrokeQueryVo> paging = strokeService.getStrokePageList(strokePageParam);
return ApiResult.ok(paging);
}
public ApiResult<Paging<StrokeQueryVo>> getStrokePageList(@Validated @RequestBody StrokePageParam strokePageParam) throws Exception {
Paging<StrokeQueryVo> paging = strokeService.getStrokePageList(strokePageParam);
return ApiResult.ok(paging);
}
}
}
package com.jumeirah.api.app.entity.vo;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 行程表-返程
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "添加返程行程入参对象")
public class StrokeAddBackAndForthVo extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "出发城市id不能为空")
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@NotBlank(message = "出发城市名称不能为空")
@ApiModelProperty("出发城市名称")
private String cityOutsetName;
@NotNull(message = "到达城市id不能为空")
@ApiModelProperty("到达城市id")
private Long cityArriveId;
@NotBlank(message = "到达城市名称不能为空")
@ApiModelProperty("到达城市名称")
private String cityArriveName;
@NotNull(message = "人数不能为空")
@ApiModelProperty("人数")
private Integer peopleMun;
@NotNull(message = "飞机型号ID不能为空")
@ApiModelProperty("飞机型号ID")
private Long plainTypeId;
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Long outsetTime;
@NotNull(message = "返程时间不能为空")
@ApiModelProperty("返程时间")
private Long returnTime;
}
package com.jumeirah.api.app.entity.vo;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "添加货运行程入参对象")
public class StrokeAddFreightVo extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "出发城市id不能为空")
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@NotBlank(message = "出发城市名称不能为空")
@ApiModelProperty("出发城市名称")
private String cityOutsetName;
@NotNull(message = "到达城市id不能为空")
@ApiModelProperty("到达城市id")
private Long cityArriveId;
@NotBlank(message = "到达城市名称不能为空")
@ApiModelProperty("到达城市名称")
private String cityArriveName;
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Long outsetTime;
@NotBlank(message = "货物名称不能为空")
@ApiModelProperty("货物名称")
private String goodsName;
@NotBlank(message = "货物体积不能为空")
@ApiModelProperty("货物体积(长*宽*高) 单位:CM,例如:100*102*120")
private String goodsSize;
@NotNull(message = "货物重量不能为空")
@ApiModelProperty("货物重量,单位:吨")
private Double goodsWeight;
}
package com.jumeirah.api.app.entity.vo;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "添加医疗行程入参对象")
public class StrokeAddMedicalTreatmentVo extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "出发城市id不能为空")
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@NotBlank(message = "出发城市名称不能为空")
@ApiModelProperty("出发城市名称")
private String cityOutsetName;
@NotNull(message = "到达城市id不能为空")
@ApiModelProperty("到达城市id")
private Long cityArriveId;
@NotBlank(message = "到达城市名称不能为空")
@ApiModelProperty("到达城市名称")
private String cityArriveName;
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Long outsetTime;
@NotBlank(message = "到达城市名称不能为空")
@ApiModelProperty("病人疾病名称")
private String diseaseName;
@NotBlank(message = "病人病情诊断书不能为空")
@ApiModelProperty("病人病情诊断书")
private String medicalCertificateUrl;
@ApiModelProperty("配备器械(格式:1,2,3)逗号分隔")
private String instruments;
@ApiModelProperty("医护人员,0-医生,1-护士,2-护工(格式:0,1,2)逗号分隔")
private String medicalPersons;
@ApiModelProperty("备注")
private String remarks;
}
package com.jumeirah.api.app.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "添加单程行程入参对象")
public class StrokeAddOneWayVo extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "出发城市id不能为空")
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@NotBlank(message = "出发城市名称不能为空")
@ApiModelProperty("出发城市名称")
private String cityOutsetName;
@NotNull(message = "到达城市id不能为空")
@ApiModelProperty("到达城市id")
private Long cityArriveId;
@NotBlank(message = "到达城市名称不能为空")
@ApiModelProperty("到达城市名称")
private String cityArriveName;
@NotNull(message = "人数不能为空")
@ApiModelProperty("人数")
private Integer peopleMun;
@NotNull(message = "飞机型号ID不能为空")
@ApiModelProperty("飞机型号ID")
private Long plainTypeId;
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Long outsetTime;
}
......@@ -62,10 +62,10 @@ public class Stroke extends BaseEntity {
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Date outsetTime;
private Long outsetTime;
@ApiModelProperty("返程时间")
private Date returnTime;
private Long returnTime;
@NotNull(message = "行程类型,0-单程,1-往返行程,2-货运,3-医疗不能为空")
@ApiModelProperty("行程类型,0-单程,1-往返行程,2-货运,3-医疗")
......@@ -95,7 +95,7 @@ public class Stroke extends BaseEntity {
private String diseaseName;
@ApiModelProperty("病人病情诊断书")
private String aegerUrl;
private String medicalCertificateUrl;
@ApiModelProperty("配备器械(格式:1,2,3)逗号分隔")
private String instruments;
......@@ -113,4 +113,12 @@ public class Stroke extends BaseEntity {
@ApiModelProperty("用户ID")
private Long userId;
@NotNull(message = "商家id不能为空")
@ApiModelProperty("商家id")
private Long mcId;
@NotNull(message = "用户选择机型不能为空")
@ApiModelProperty("用户选择机型")
private Long choosePlainType;
}
......@@ -14,49 +14,49 @@ import io.geekidea.springbootplus.framework.core.pagination.Paging;
*/
public interface StrokeService extends BaseService<Stroke> {
/**
* 保存
*
* @param stroke
* @return
* @throws Exception
*/
boolean saveStroke(Stroke stroke)throws Exception;
/**
* 修改
*
* @param stroke
* @return
* @throws Exception
*/
boolean updateStroke(Stroke stroke)throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteStroke(Long id)throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
StrokeQueryVo getStrokeById(Long id)throws Exception;
/**
* 获取分页对象
*
* @param strokePageParam
* @return
* @throws Exception
*/
Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam) throws Exception;
}
/**
* 保存
*
* @param stroke
* @return
* @throws Exception
*/
boolean saveStroke(Stroke stroke) throws Exception;
/**
* 修改
*
* @param stroke
* @return
* @throws Exception
*/
boolean updateStroke(Stroke stroke) throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteStroke(Long id) throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
StrokeQueryVo getStrokeById(Long id) throws Exception;
/**
* 获取分页对象
*
* @param strokePageParam
* @return
* @throws Exception
*/
Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam) throws Exception;
}
......@@ -3,15 +3,15 @@ package com.jumeirah.common.service.impl;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.mapper.StrokeMapper;
import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.vo.StrokeQueryVo;
import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,37 +26,37 @@ import org.springframework.beans.factory.annotation.Autowired;
@Service
public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> implements StrokeService {
@Autowired
private StrokeMapper strokeMapper;
@Autowired
private StrokeMapper strokeMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveStroke(Stroke stroke)throws Exception{
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveStroke(Stroke stroke) throws Exception {
return super.save(stroke);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateStroke(Stroke stroke)throws Exception{
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateStroke(Stroke stroke) throws Exception {
return super.updateById(stroke);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteStroke(Long id)throws Exception{
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteStroke(Long id) throws Exception {
return super.removeById(id);
}
}
@Override
public StrokeQueryVo getStrokeById(Long id) throws Exception {
return strokeMapper.getStrokeById(id);
}
@Override
public StrokeQueryVo getStrokeById(Long id)throws Exception{
return strokeMapper.getStrokeById(id);
}
@Override
public Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam)throws Exception{
Page<StrokeQueryVo> page=new PageInfo<>(strokePageParam,OrderItem.desc(getLambdaColumn(Stroke::getCreateTime)));
IPage<StrokeQueryVo> iPage= strokeMapper.getStrokePageList(page, strokePageParam);
public Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam) throws Exception {
Page<StrokeQueryVo> page = new PageInfo<>(strokePageParam, OrderItem.desc(getLambdaColumn(Stroke::getCreateTime)));
IPage<StrokeQueryVo> iPage = strokeMapper.getStrokePageList(page, strokePageParam);
return new Paging<StrokeQueryVo>(iPage);
}
}
}
}
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