Commit b888d46b by lpx

# 商家管理端飞机管理相关接口

parent 82c0b977
......@@ -12,6 +12,7 @@ import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
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.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -41,7 +42,7 @@ public class McPlainTypeController extends BaseController {
@GetMapping("/getAllList")
@OperationLog(name = "获取飞机型号列表", type = OperationLogType.PAGE)
@ApiOperation(value = "获取飞机型号列表", response = PlainTypeQueryVo.class)
// @RequiresPermissions("merchant:aircraft:management:view")
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<List<PlainType> > getAllList() throws Exception {
List<PlainType> plainTypeList = plainTypeService.getAllMap();
return ApiResult.ok(plainTypeList);
......
......@@ -17,6 +17,7 @@ import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
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;
......@@ -25,6 +26,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.sql.Timestamp;
/**
* 行程表 控制器
*
......@@ -46,10 +49,11 @@ public class McStrokeController extends BaseController {
@PostMapping("/complete")
@OperationLog(name = "完成行程接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "完成行程接口", response = ApiResult.class)
// @RequiresPermissions("merchant:order:edit")
@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);
......@@ -61,7 +65,7 @@ public class McStrokeController extends BaseController {
@PostMapping("/getPageList")
@OperationLog(name = "行程分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程分页列表")
// @RequiresPermissions("merchant:order:view")
@RequiresPermissions("merchant:order:view")
public ApiResult<Paging<McStrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody McStrokePageParam mcStrokePageParam) throws Exception {
Paging<McStrokeQueryVo> paging = strokeService.getMcStrokePageList(mcStrokePageParam);
return ApiResult.ok(paging);
......@@ -73,10 +77,11 @@ public class McStrokeController extends BaseController {
@PostMapping("/update/quotedPrice")
@OperationLog(name = "行程报价接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "行程报价接口", response = ApiResult.class)
// @RequiresPermissions("merchant:order:edit")
@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);
}
......@@ -87,10 +92,11 @@ public class McStrokeController extends BaseController {
@PostMapping("/discount/check")
@OperationLog(name = "优惠调机审核接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "优惠调机审核接口", response = ApiResult.class)
// @RequiresPermissions("merchant:order:edit")
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> checkStrokeDiscount(@Validated @RequestBody StrokeDiscountCheckParam strokeDiscountCheckParam) throws Exception {
Stroke stroke = new Stroke();
stroke.setId(strokeDiscountCheckParam.getId())
.setUpdateTime(new Timestamp(System.currentTimeMillis()))
.setAuditStatus(strokeDiscountCheckParam.getAuditStatus());
boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag);
......@@ -102,16 +108,18 @@ public class McStrokeController extends BaseController {
@PostMapping("/confirmPayment")
@OperationLog(name = "优惠调机审核接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "优惠调机审核接口", response = ApiResult.class)
// @RequiresPermissions("merchant:order:edit")
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> confirmPaymentStroke(@Validated @RequestBody StrokeConfirmPaymentParam strokeConfirmPaymentParam) throws Exception {
Stroke stroke = new Stroke();
stroke.setId(strokeConfirmPaymentParam.getId())
.setStatus(StrokeStatusEnum.PROCESSING.getCode())
.setUpdateTime(new Timestamp(System.currentTimeMillis()))
.setPaymentStatus(strokeConfirmPaymentParam.getPaymentStatus());
boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag);
}
/* *//**
/* *//**
* 修改行程表
*//*
@PostMapping("/update")
......
package com.jumeirah.api.merchant.controller.plain;
import com.jumeirah.api.merchant.entity.param.McPlainAddParam;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.param.McPlainQueryVo;
import com.jumeirah.common.vo.McPlainQueryVo;
import com.jumeirah.common.service.McPlainService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
......@@ -11,9 +12,13 @@ import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
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.GetMapping;
......@@ -31,7 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Slf4j
@RestController
@RequestMapping("/mcPlain")
@RequestMapping("/merchant/mcPlain")
@Api(value = "商家飞机表API", tags = {"商家飞机表"})
public class McPlainController extends BaseController {
......@@ -44,7 +49,12 @@ public class McPlainController extends BaseController {
@PostMapping("/add")
@OperationLog(name = "添加商家飞机表", type = OperationLogType.ADD)
@ApiOperation(value = "添加商家飞机表")
public ApiResult<Boolean> addMcPlain(@Validated(Add.class) @RequestBody McPlain mcPlain) throws Exception {
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> addMcPlain(@Validated(Add.class) @RequestBody McPlainAddParam mcPlainAddParam) throws Exception {
McPlain mcPlain = new McPlain();
BeanUtils.copyProperties(mcPlainAddParam, mcPlain);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
mcPlain.setMcId(jwtToken.getMcId());
boolean flag = mcPlainService.saveMcPlain(mcPlain);
return ApiResult.result(flag);
}
......@@ -55,7 +65,9 @@ public class McPlainController extends BaseController {
@PostMapping("/update")
@OperationLog(name = "修改商家飞机表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家飞机表")
public ApiResult<Boolean> updateMcPlain(@Validated(Update.class) @RequestBody McPlain mcPlain) throws Exception {
public ApiResult<Boolean> updateMcPlain(@Validated(Update.class) @RequestBody McPlainAddParam mcPlainAddParam) throws Exception {
McPlain mcPlain = new McPlain();
BeanUtils.copyProperties(mcPlainAddParam, mcPlain);
boolean flag = mcPlainService.updateMcPlain(mcPlain);
return ApiResult.result(flag);
}
......
package com.jumeirah.api.merchant.entity.param;
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.NotNull;
/**
* 商家飞机表
*
* @author xxx
* @since 2020-10-19
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "McPlain对象")
public class McPlainAddParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("主键ID")
private Long id;
@NotNull(message = "飞机类型ID不能为空")
@ApiModelProperty("飞机类型ID")
private Long ptId;
@NotNull(message = "数量不能为空")
@ApiModelProperty("数量")
private Integer amount;
@NotNull(message = "所在地城市ID不能为空")
@ApiModelProperty("所在地城市ID")
private Long cityId;
}
......@@ -2,7 +2,7 @@ package com.jumeirah.common.controller;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.param.McPlainQueryVo;
import com.jumeirah.common.vo.McPlainQueryVo;
import com.jumeirah.common.service.McPlainService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
......
......@@ -11,6 +11,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
/**
* 商家飞机表
......@@ -40,10 +41,10 @@ public class McPlain extends BaseEntity {
@NotNull(message = "创建时间(时间戳)不能为空")
@ApiModelProperty("创建时间(时间戳)")
private Long createTime;
private Timestamp createTime;
@ApiModelProperty("更新时间(时间戳)")
private Long updateTime;
private Timestamp updateTime;
@NotNull(message = "商家ID不能为空")
@ApiModelProperty("商家ID")
......
......@@ -3,7 +3,7 @@ package com.jumeirah.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.param.McPlainQueryVo;
import com.jumeirah.common.vo.McPlainQueryVo;
import org.springframework.stereotype.Repository;
......
......@@ -28,6 +28,9 @@ public class McStrokePageParam extends BasePageOrderParam {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("状态,-1全部,0-审核中,1-进行中,2-已完成,99-取消")
private Integer status;
@ApiModelProperty("开始时间")
private String startTime;
......
......@@ -3,7 +3,7 @@ package com.jumeirah.common.service;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.param.McPlainPageParam;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import com.jumeirah.common.param.McPlainQueryVo;
import com.jumeirah.common.vo.McPlainQueryVo;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
......
......@@ -4,7 +4,7 @@ import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.mapper.McPlainMapper;
import com.jumeirah.common.service.McPlainService;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.param.McPlainQueryVo;
import com.jumeirah.common.vo.McPlainQueryVo;
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;
......
package com.jumeirah.common.param;
package com.jumeirah.common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -27,6 +27,9 @@ public class McPlainQueryVo implements Serializable {
@ApiModelProperty("飞机类型ID")
private Long ptId;
@ApiModelProperty("飞机类型名称")
private String ptName;
@ApiModelProperty("状态,0-正常,1-禁用,99-删除")
private Integer status;
......@@ -44,4 +47,10 @@ public class McPlainQueryVo implements Serializable {
@ApiModelProperty("所在地城市ID")
private Long cityId;
@ApiModelProperty("所在地城市名称")
private String cityName;
@ApiModelProperty("飞机图片地址")
private String imgUrl;
}
......@@ -4,20 +4,32 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, pt_id, status, create_time, update_time, mc_id, amount, city_id
id,
pt_id,
status,
create_time,
update_time,
mc_id,
amount,
city_id
</sql>
<select id="getMcPlainById" resultType="com.jumeirah.common.param.McPlainQueryVo">
<select id="getMcPlainById" resultType="com.jumeirah.common.vo.McPlainQueryVo">
select
<include refid="Base_Column_List"/>
from mc_plain where id = #{id}
</select>
<select id="getMcPlainPageList" parameterType="com.jumeirah.common.param.McPlainPageParam"
resultType="com.jumeirah.common.param.McPlainQueryVo">
resultType="com.jumeirah.common.vo.McPlainQueryVo">
select
<include refid="Base_Column_List"/>
from mc_plain
pt.name as pt_name,
pt.img_url,
ctc.city_name_cn as city_name,
mp.*
from mc_plain mp
left join plain_type pt on pt.id = mp.pt_id
left join city_three_code ctc on ctc.id = mp.city_id
</select>
</mapper>
......@@ -128,6 +128,9 @@
LEFT JOIN app_user au ON au.id = s.user_id
LEFT JOIN plain_type pt ON pt.id = s.plain_type_id
<where>
<if test="mcStrokePageParam.status != null and mcStrokePageParam.status != -1">
AND s.status = #{mcStrokePageParam.status}
</if>
<if test="mcStrokePageParam.type != null and mcStrokePageParam.type != -1">
AND s.type = #{mcStrokePageParam.type}
</if>
......
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