Commit 7b31fc0f by lpx

# 商家管理端优惠调机相关接口

parent b888d46b
...@@ -3,8 +3,8 @@ package com.jumeirah.api.merchant.controller.plain; ...@@ -3,8 +3,8 @@ package com.jumeirah.api.merchant.controller.plain;
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.param.McPlainPageParam; import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.vo.McPlainQueryVo;
import com.jumeirah.common.service.McPlainService; import com.jumeirah.common.service.McPlainService;
import com.jumeirah.common.vo.McPlainQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController; import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.core.pagination.Paging; import io.geekidea.springbootplus.framework.core.pagination.Paging;
...@@ -21,7 +21,6 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; ...@@ -21,7 +21,6 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
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;
...@@ -65,6 +64,7 @@ public class McPlainController extends BaseController { ...@@ -65,6 +64,7 @@ public class McPlainController extends BaseController {
@PostMapping("/update") @PostMapping("/update")
@OperationLog(name = "修改商家飞机表", type = OperationLogType.UPDATE) @OperationLog(name = "修改商家飞机表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家飞机表") @ApiOperation(value = "修改商家飞机表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> updateMcPlain(@Validated(Update.class) @RequestBody McPlainAddParam mcPlainAddParam) throws Exception { public ApiResult<Boolean> updateMcPlain(@Validated(Update.class) @RequestBody McPlainAddParam mcPlainAddParam) throws Exception {
McPlain mcPlain = new McPlain(); McPlain mcPlain = new McPlain();
BeanUtils.copyProperties(mcPlainAddParam, mcPlain); BeanUtils.copyProperties(mcPlainAddParam, mcPlain);
...@@ -76,6 +76,7 @@ public class McPlainController extends BaseController { ...@@ -76,6 +76,7 @@ public class McPlainController extends BaseController {
* 删除商家飞机表 * 删除商家飞机表
*/ */
@PostMapping("/delete/{id}") @PostMapping("/delete/{id}")
@RequiresPermissions("merchant:aircraft:management:edit")
@OperationLog(name = "删除商家飞机表", type = OperationLogType.DELETE) @OperationLog(name = "删除商家飞机表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除商家飞机表") @ApiOperation(value = "删除商家飞机表")
public ApiResult<Boolean> deleteMcPlain(@PathVariable("id") Long id) throws Exception { public ApiResult<Boolean> deleteMcPlain(@PathVariable("id") Long id) throws Exception {
...@@ -86,13 +87,13 @@ public class McPlainController extends BaseController { ...@@ -86,13 +87,13 @@ public class McPlainController extends BaseController {
/** /**
* 获取商家飞机表详情 * 获取商家飞机表详情
*/ */
@GetMapping("/info/{id}") /* @GetMapping("/info/{id}")
@OperationLog(name = "商家飞机表详情", type = OperationLogType.INFO) @OperationLog(name = "商家飞机表详情", type = OperationLogType.INFO)
@ApiOperation(value = "商家飞机表详情") @ApiOperation(value = "商家飞机表详情")
public ApiResult<McPlainQueryVo> getMcPlain(@PathVariable("id") Long id) throws Exception { public ApiResult<McPlainQueryVo> getMcPlain(@PathVariable("id") Long id) throws Exception {
McPlainQueryVo mcPlainQueryVo = mcPlainService.getMcPlainById(id); McPlainQueryVo mcPlainQueryVo = mcPlainService.getMcPlainById(id);
return ApiResult.ok(mcPlainQueryVo); return ApiResult.ok(mcPlainQueryVo);
} }*/
/** /**
* 商家飞机表分页列表 * 商家飞机表分页列表
...@@ -100,6 +101,7 @@ public class McPlainController extends BaseController { ...@@ -100,6 +101,7 @@ public class McPlainController extends BaseController {
@PostMapping("/getPageList") @PostMapping("/getPageList")
@OperationLog(name = "商家飞机表分页列表", type = OperationLogType.PAGE) @OperationLog(name = "商家飞机表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "商家飞机表分页列表") @ApiOperation(value = "商家飞机表分页列表")
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<Paging<McPlainQueryVo>> getMcPlainPageList(@Validated @RequestBody McPlainPageParam mcPlainPageParam) throws Exception { public ApiResult<Paging<McPlainQueryVo>> getMcPlainPageList(@Validated @RequestBody McPlainPageParam mcPlainPageParam) throws Exception {
Paging<McPlainQueryVo> paging = mcPlainService.getMcPlainPageList(mcPlainPageParam); Paging<McPlainQueryVo> paging = mcPlainService.getMcPlainPageList(mcPlainPageParam);
return ApiResult.ok(paging); return ApiResult.ok(paging);
......
package com.jumeirah.api.merchant.controller.plain;
import com.jumeirah.api.merchant.entity.param.McStrokeDiscountAddParam;
import com.jumeirah.common.entity.StrokeDiscount;
import com.jumeirah.common.param.StrokeDiscountPageParam;
import com.jumeirah.common.service.StrokeDiscountService;
import com.jumeirah.common.vo.StrokeDiscountQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 优惠行程表 控制器
*
* @author xxx
* @since 2020-10-14
*/
@Slf4j
@RestController
@RequestMapping("/merchant/strokeDiscount")
@Api(value = "优惠行程表API", tags = {"优惠行程表"})
public class McStrokeDiscountController extends BaseController {
@Autowired
private StrokeDiscountService strokeDiscountService;
/**
* 添加优惠行程表
*/
@PostMapping("/add")
@OperationLog(name = "添加优惠行程表", type = OperationLogType.ADD)
@ApiOperation(value = "添加优惠行程表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> addStrokeDiscount(@Validated(Add.class) @RequestBody McStrokeDiscountAddParam mcStrokeDiscountAddParam) throws Exception {
StrokeDiscount strokeDiscount = new StrokeDiscount();
BeanUtils.copyProperties(mcStrokeDiscountAddParam,strokeDiscount);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
strokeDiscount.setMcId(jwtToken.getMcId());
boolean flag = strokeDiscountService.saveStrokeDiscount(strokeDiscount);
return ApiResult.result(flag);
}
/**
* 修改优惠行程表
*/
/* @PostMapping("/update")
@OperationLog(name = "修改优惠行程表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改优惠行程表")
public ApiResult<Boolean> updateStrokeDiscount(@Validated(Update.class) @RequestBody StrokeDiscount strokeDiscount) throws Exception {
boolean flag = strokeDiscountService.updateStrokeDiscount(strokeDiscount);
return ApiResult.result(flag);
}*/
/**
* 删除优惠行程表
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除优惠行程表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除优惠行程表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> deleteStrokeDiscount(@PathVariable("id") Long id) throws Exception {
boolean flag = strokeDiscountService.deleteStrokeDiscount(id);
return ApiResult.result(flag);
}
/**
* 获取优惠行程表详情
*/
/*@GetMapping("/info/{id}")
@OperationLog(name = "优惠行程表详情", type = OperationLogType.INFO)
@ApiOperation(value = "优惠行程表详情")
public ApiResult<StrokeDiscountQueryVo> getStrokeDiscount(@PathVariable("id") Long id) throws Exception {
StrokeDiscountQueryVo strokeDiscountQueryVo = strokeDiscountService.getStrokeDiscountById(id);
return ApiResult.ok(strokeDiscountQueryVo);
}*/
/**
* 优惠行程表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "优惠行程表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "优惠行程表分页列表")
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<Paging<StrokeDiscountQueryVo>> getStrokeDiscountPageList(@Validated @RequestBody StrokeDiscountPageParam strokeDiscountPageParam) throws Exception {
Paging<StrokeDiscountQueryVo> paging = strokeDiscountService.getStrokeDiscountPageList(strokeDiscountPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.merchant.entity.param;
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.NotNull;
import java.math.BigDecimal;
/**
* 优惠行程表
*
* @author xxx
* @since 2020-10-14
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "StrokeDiscount对象")
public class McStrokeDiscountAddParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "出发城市id不能为空")
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@NotNull(message = "到达城市id不能为空")
@ApiModelProperty("到达城市id")
private Long cityArriveId;
@NotNull(message = "座位数不能为空")
@ApiModelProperty("座位数")
private Integer seatNum;
@NotNull(message = "飞机型号ID不能为空")
@ApiModelProperty("飞机型号ID")
private Long plainTypeId;
@ApiModelProperty("飞机型号名称")
private String plainTypeName;
@ApiModelProperty("价格")
private BigDecimal money;
}
package com.jumeirah.common.enums;
import io.geekidea.springbootplus.framework.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 状态,0-正常,1-完成,99-删除
*/
@Getter
@AllArgsConstructor
public enum StrokeDiscountStatusEnum implements BaseEnum {
OK(0, "正常"),
COMPLETE(1, "完成"),
CANCEL(99, "取消");
/**
* 编号
*/
private final Integer code;
/**
* 名称
*/
private final String desc;
}
package com.jumeirah.common.service.impl; package com.jumeirah.common.service.impl;
import com.jumeirah.common.entity.StrokeDiscount; import com.jumeirah.common.entity.StrokeDiscount;
import com.jumeirah.common.enums.StrokeDiscountStatusEnum;
import com.jumeirah.common.mapper.StrokeDiscountMapper; import com.jumeirah.common.mapper.StrokeDiscountMapper;
import com.jumeirah.common.service.StrokeDiscountService; import com.jumeirah.common.service.StrokeDiscountService;
import com.jumeirah.common.param.StrokeDiscountPageParam; import com.jumeirah.common.param.StrokeDiscountPageParam;
...@@ -44,7 +45,10 @@ public class StrokeDiscountServiceImpl extends BaseServiceImpl<StrokeDiscountMap ...@@ -44,7 +45,10 @@ public class StrokeDiscountServiceImpl extends BaseServiceImpl<StrokeDiscountMap
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean deleteStrokeDiscount(Long id) throws Exception { public boolean deleteStrokeDiscount(Long id) throws Exception {
return super.removeById(id); StrokeDiscount strokeDiscount = new StrokeDiscount();
strokeDiscount.setId(id)
.setStatus(StrokeDiscountStatusEnum.CANCEL.getCode());
return super.updateById(strokeDiscount);
} }
@Override @Override
......
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