Commit 29717422 by giaogiao

修改包机介绍的权限

parent a570531e
......@@ -17,6 +17,7 @@ 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.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -49,6 +50,7 @@ public class CharterIntroductionForMerController extends BaseController {
@PostMapping("/add")
@OperationLog(name = "添加包机介绍", type = OperationLogType.ADD)
@ApiOperation(value = "添加包机介绍")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> addCharterIntroduction(@Validated(Add.class) @RequestBody CharterIntroductionAddParam charterIntroductionAddParam) throws Exception {
boolean flag = charterIntroductionService.saveCharterIntroduction(charterIntroductionAddParam);
return ApiResult.result(flag);
......@@ -60,6 +62,7 @@ public class CharterIntroductionForMerController extends BaseController {
@PostMapping("/update")
@OperationLog(name = "修改包机介绍", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改包机介绍")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> updateCharterIntroduction(@Validated(Update.class) @RequestBody CharterIntroductionUpdateParam charterIntroductionUpdateParam) throws Exception {
boolean flag = charterIntroductionService.updateCharterIntroduction(charterIntroductionUpdateParam);
return ApiResult.result(flag);
......@@ -71,6 +74,7 @@ public class CharterIntroductionForMerController extends BaseController {
@PostMapping("/delete/{id}")
@OperationLog(name = "删除包机介绍", type = OperationLogType.DELETE)
@ApiOperation(value = "删除包机介绍")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> deleteCharterIntroduction(@PathVariable("id") Long id) throws Exception {
boolean flag = charterIntroductionService.deleteCharterIntroduction(id);
return ApiResult.result(flag);
......@@ -82,6 +86,7 @@ public class CharterIntroductionForMerController extends BaseController {
@GetMapping("/info/{id}")
@OperationLog(name = "包机介绍详情", type = OperationLogType.INFO)
@ApiOperation(value = "包机介绍详情")
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<CharterIntroductionQueryVo> getCharterIntroduction(@PathVariable("id") Long id) throws Exception {
CharterIntroductionQueryVo charterIntroductionQueryVo = charterIntroductionService.getCharterIntroductionById(id);
return ApiResult.ok(charterIntroductionQueryVo);
......@@ -93,6 +98,7 @@ public class CharterIntroductionForMerController extends BaseController {
@PostMapping("/getPageList")
@OperationLog(name = "包机介绍分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "包机介绍分页列表")
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<List<CharterIntroduction>> getCharterIntroductionPageList() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
......
package com.jumeirah.common.param;
import com.jumeirah.common.vo.CharterIntroductionImgForAppVo;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -7,6 +8,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 包机介绍
*
......@@ -20,8 +23,8 @@ import lombok.experimental.Accessors;
public class CharterIntroductionAddParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "包机图片url, json字符串", example = "[{\"url\":\"https://picsum.photos/100/200/\",\"height\":200,\"width\":200},{\"url\":\"https://picsum.photos/100/200/\",\"height\":200,\"width\":200},{\"url\":\"https://picsum.photos/100/200/\",\"height\":200,\"width\":200}]")
private String imgUrl;
@ApiModelProperty(value = "包机图片url")
private List<CharterIntroductionImgForAppVo> imgList;
@ApiModelProperty(value = "包机文字")
private String text;
......
......@@ -61,6 +61,13 @@ public interface CharterIntroductionService extends BaseService<CharterIntroduct
*/
Paging<CharterIntroductionQueryVo> getCharterIntroductionPageList(CharterIntroductionPageParam charterIntroductionPageParam) throws Exception;
/**
* 包机介绍分页-- app调用
*
* @param charterIntroductionPageParam
* @return
* @throws Exception
*/
Paging<CharterIntroductionQueryForAppVo> getCharterIntroductionForAppPageList(CharterIntroductionPageParam charterIntroductionPageParam) throws Exception;
}
......@@ -18,6 +18,7 @@ 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 io.geekidea.springbootplus.framework.util.Jackson;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
......@@ -46,6 +47,8 @@ public class CharterIntroductionServiceImpl extends BaseServiceImpl<CharterIntro
public boolean saveCharterIntroduction(CharterIntroductionAddParam charterIntroductionAddParam) throws Exception {
CharterIntroduction charterIntroduction = new CharterIntroduction();
BeanUtils.copyProperties(charterIntroductionAddParam, charterIntroduction);
// 图片列表转json
charterIntroduction.setImgUrl(Jackson.toJsonString(charterIntroductionAddParam.getImgList()));
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
charterIntroduction.setMcId(jwtToken.getMcId());
return super.save(charterIntroduction);
......@@ -83,21 +86,19 @@ public class CharterIntroductionServiceImpl extends BaseServiceImpl<CharterIntro
Page<CharterIntroductionQueryForAppVo> page = new PageInfo<>(charterIntroductionPageParam, OrderItem.desc("ci.create_time"));
IPage<CharterIntroductionQueryForAppVo> iPage = charterIntroductionMapper.getCharterIntroductionForAppPageList(page, charterIntroductionPageParam);
List<CharterIntroductionQueryForAppVo> records = iPage.getRecords();
// 处理过的数据列表
List<CharterIntroductionQueryForAppVo> newRecords = new ArrayList<CharterIntroductionQueryForAppVo>();
for (CharterIntroductionQueryForAppVo charterIntroductionQueryForAppVo : records) {
// 对数据做二次处理
for (CharterIntroductionQueryForAppVo charterIntroductionQueryForAppVo : iPage.getRecords()) {
ObjectMapper objectMapper = new ObjectMapper();
JavaType javaType = objectMapper.getTypeFactory().constructCollectionType(ArrayList.class, CharterIntroductionImgForAppVo.class);
// 处理图片url, 因为数据库存的json 需要转换
List<CharterIntroductionImgForAppVo> lst = (List<CharterIntroductionImgForAppVo>) objectMapper.readValue(charterIntroductionQueryForAppVo.getImgUrl(), javaType);
charterIntroductionQueryForAppVo.setImgList(lst);
charterIntroductionQueryForAppVo.setImgUrl(null);
newRecords.add(charterIntroductionQueryForAppVo);
}
iPage.setRecords(newRecords);
return new Paging<>(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