Commit 6e7ceef4 by giaogiao

初始化四恩慈善会

parent ed80f11d
# 卓美亚航空 - 后端项目 # 四恩慈善 - 后端项目
## 框架介绍 ## 框架介绍
> 本项目使用第三方开源脚手架项目: spring-boot-plus 参考:README-zh.md > 本项目使用第三方开源脚手架项目: spring-boot-plus 参考:README-zh.md
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
└── api-app app的api模块 └── api-app app的api模块
└── api-merchant 商家api服务模块 └── api-merchant 商家api服务模块
└── common 通用模块(包含service dao mapper) └── common 通用模块(包含service dao mapper)
``` ```McPlainTypeController
--- ---
## 安装中间件 ## 安装中间件
redis(必须本地开启) redis(必须本地开启)
......
package com.jumeirah.api.app.controller;
import com.jumeirah.common.param.MerchantPageParam;
import com.jumeirah.common.service.MerchantService;
import com.jumeirah.common.vo.MerchantQueryVo;
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.log.annotation.OperationLog;
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.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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 航空介绍 控制器
*
* @author wei
* @since 2020-09-29
*/
@Slf4j
@RestController
@RequestMapping("/app/airline")
@Api(value = "航空介绍", tags = {"航空公司介绍"})
public class AirIntroducedController extends BaseController {
@Autowired
private MerchantService merchantService;
/**
* 商家分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "航空公司介绍分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "航空公司介绍分页列表")
public ApiResult<Paging<MerchantQueryVo>> getMerchantPageList(@Validated @RequestBody MerchantPageParam merchantPageParam) throws Exception {
Paging<MerchantQueryVo> paging = merchantService.getMerchantPageList(merchantPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.app.controller;
import com.jumeirah.common.param.BusinessPlainPageParam;
import com.jumeirah.common.service.BusinessPlainService;
import com.jumeirah.common.vo.BusinessPlainQueryForAppVo;
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.log.annotation.OperationLog;
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.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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 公务机出售托管表 控制器
*
* @author giao
* @since 2020-10-14
*/
@Slf4j
@RestController
@RequestMapping("/app/businessPlain")
@Api(value = "公务机出售托管表API", tags = {"公务机出售托管表"})
public class BusinessPlainForAppController extends BaseController {
@Autowired
private BusinessPlainService businessPlainService;
// /**
// * 添加公务机出售托管表
// */
// @PostMapping("/add")
// @OperationLog(name = "添加公务机出售托管表", type = OperationLogType.ADD)
// @ApiOperation(value = "添加公务机出售托管表")
// public ApiResult<Boolean> addBusinessPlain(@Validated(Add.class) @RequestBody BusinessPlain businessPlain) throws Exception {
// boolean flag = businessPlainService.saveBusinessPlain(businessPlain);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改公务机出售托管表
// */
// @PostMapping("/update")
// @OperationLog(name = "修改公务机出售托管表", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改公务机出售托管表")
// public ApiResult<Boolean> updateBusinessPlain(@Validated(Update.class) @RequestBody BusinessPlain businessPlain) throws Exception {
// boolean flag = businessPlainService.updateBusinessPlain(businessPlain);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除公务机出售托管表
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除公务机出售托管表", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除公务机出售托管表")
// public ApiResult<Boolean> deleteBusinessPlain(@PathVariable("id") Long id) throws Exception {
// boolean flag = businessPlainService.deleteBusinessPlain(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取公务机出售托管表详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "公务机出售托管表详情", type = OperationLogType.INFO)
// @ApiOperation(value = "公务机出售托管表详情")
// public ApiResult<BusinessPlainQueryVo> getBusinessPlain(@PathVariable("id") Long id) throws Exception {
// BusinessPlainQueryVo businessPlainQueryVo = businessPlainService.getBusinessPlainById(id);
// return ApiResult.ok(businessPlainQueryVo);
// }
/**
* 公务机出售托管表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "公务机出售托管表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "公务机出售托管表分页列表")
public ApiResult<Paging<BusinessPlainQueryForAppVo>> getBusinessPlainPageList(@Validated @RequestBody BusinessPlainPageParam businessPlainPageParam) throws Exception {
Paging<BusinessPlainQueryForAppVo> paging = businessPlainService.getBusinessPlainPageListForApp(businessPlainPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.app.controller;
import com.jumeirah.common.param.CharterIntroductionPageParam;
import com.jumeirah.common.service.CharterIntroductionService;
import com.jumeirah.common.vo.CharterIntroductionQueryForAppVo;
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.log.annotation.OperationLog;
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.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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 包机介绍 控制器
*
* @author giao
* @since 2020-10-14
*/
@Slf4j
@RestController
@RequestMapping("/app/charterIntroduction")
@Api(value = "包机介绍API", tags = {"包机介绍"})
public class CharterIntroductionForAppController extends BaseController {
@Autowired
private CharterIntroductionService charterIntroductionService;
// /**
// * 添加包机介绍
// */
// @PostMapping("/add")
// @OperationLog(name = "添加包机介绍", type = OperationLogType.ADD)
// @ApiOperation(value = "添加包机介绍")
// public ApiResult<Boolean> addCharterIntroduction(@Validated(Add.class) @RequestBody CharterIntroduction charterIntroduction) throws Exception {
// boolean flag = charterIntroductionService.saveCharterIntroduction(charterIntroduction);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改包机介绍
// */
// @PostMapping("/update")
// @OperationLog(name = "修改包机介绍", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改包机介绍")
// public ApiResult<Boolean> updateCharterIntroduction(@Validated(Update.class) @RequestBody CharterIntroduction charterIntroduction) throws Exception {
// boolean flag = charterIntroductionService.updateCharterIntroduction(charterIntroduction);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除包机介绍
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除包机介绍", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除包机介绍")
// public ApiResult<Boolean> deleteCharterIntroduction(@PathVariable("id") Long id) throws Exception {
// boolean flag = charterIntroductionService.deleteCharterIntroduction(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取包机介绍详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "包机介绍详情", type = OperationLogType.INFO)
// @ApiOperation(value = "包机介绍详情")
// public ApiResult<CharterIntroductionQueryVo> getCharterIntroduction(@PathVariable("id") Long id) throws Exception {
// CharterIntroductionQueryVo charterIntroductionQueryVo = charterIntroductionService.getCharterIntroductionById(id);
// return ApiResult.ok(charterIntroductionQueryVo);
// }
// /**
// * 包机介绍分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "包机介绍分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "包机介绍分页列表")
// public ApiResult<Paging<CharterIntroductionQueryVo>> getCharterIntroductionPageList(@Validated @RequestBody CharterIntroductionPageParam charterIntroductionPageParam) throws Exception {
// Paging<CharterIntroductionQueryVo> paging = charterIntroductionService.getCharterIntroductionPageList(charterIntroductionPageParam);
// return ApiResult.ok(paging);
// }
/**
* 包机介绍分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "包机介绍分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "包机介绍分页列表")
public ApiResult<Paging<CharterIntroductionQueryForAppVo>> getCharterIntroductionPageList(@Validated @RequestBody CharterIntroductionPageParam charterIntroductionPageParam) throws Exception {
Paging<CharterIntroductionQueryForAppVo> paging = charterIntroductionService.getCharterIntroductionForAppPageList(charterIntroductionPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.app.controller;
import com.jumeirah.api.app.entity.param.FeedbackAddParam;
import com.jumeirah.common.entity.Feedback;
import com.jumeirah.common.service.FeedbackService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 意见反馈 控制器
*
* @author giao
* @since 2020-10-26
*/
@Slf4j
@RestController
@RequestMapping("/app/feedback")
@Api(value = "意见反馈API", tags = {"意见反馈"})
public class FeedbackController extends BaseController {
@Autowired
private FeedbackService feedbackService;
/**
* 添加意见反馈
*/
@PostMapping("/add")
@OperationLog(name = "添加意见反馈", type = OperationLogType.ADD)
@ApiOperation(value = "添加意见反馈")
public ApiResult<Boolean> addFeedback(@Validated(Add.class) @RequestBody FeedbackAddParam feedbackAddParam) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Feedback feedback = new Feedback();
feedback.setUserId(jwtToken.getUserId());
feedback.setContent(feedbackAddParam.getContent());
boolean flag = feedbackService.saveFeedback(feedback);
return ApiResult.result(flag);
}
//
// /**
// * 修改意见反馈
// */
// @PostMapping("/update")
// @OperationLog(name = "修改意见反馈", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改意见反馈")
// public ApiResult<Boolean> updateFeedback(@Validated(Update.class) @RequestBody Feedback feedback) throws Exception {
// boolean flag = feedbackService.updateFeedback(feedback);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除意见反馈
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除意见反馈", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除意见反馈")
// public ApiResult<Boolean> deleteFeedback(@PathVariable("id") Long id) throws Exception {
// boolean flag = feedbackService.deleteFeedback(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取意见反馈详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "意见反馈详情", type = OperationLogType.INFO)
// @ApiOperation(value = "意见反馈详情")
// public ApiResult<FeedbackQueryVo> getFeedback(@PathVariable("id") Long id) throws Exception {
// FeedbackQueryVo feedbackQueryVo = feedbackService.getFeedbackById(id);
// return ApiResult.ok(feedbackQueryVo);
// }
//
// /**
// * 意见反馈分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "意见反馈分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "意见反馈分页列表")
// public ApiResult<Paging<FeedbackQueryVo>> getFeedbackPageList(@Validated @RequestBody FeedbackPageParam feedbackPageParam) throws Exception {
// Paging<FeedbackQueryVo> paging = feedbackService.getFeedbackPageList(feedbackPageParam);
// return ApiResult.ok(paging);
// }
}
package com.jumeirah.api.app.controller;
import com.jumeirah.common.entity.Merchant;
import com.jumeirah.common.service.MerchantService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author: JJww
* @Date:2020/11/5
*/
@Slf4j
@RestController
@RequestMapping("/app/merchant")
@Api(value = "商户相关接口")
public class MerchantController {
@Autowired
private MerchantService merchantService;
/**
* 航空公司商家表
*/
@GetMapping("/list")
@OperationLog(name = "航空公司商家列表", type = OperationLogType.LIST)
@ApiOperation(value = "航空公司商家列表")
public ApiResult<List<Merchant>> getMerchantList() {
return ApiResult.ok(merchantService.getMerchantList());
}
}
package com.jumeirah.api.app.controller;
import com.jumeirah.api.app.entity.bo.PlainTypeBo;
import com.jumeirah.common.entity.PlainType;
import com.jumeirah.common.service.PlainTypeService;
import com.jumeirah.common.vo.PlainTypeQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 飞机型号表 控制器
*
* @author wei
* @since 2020-10-09
*/
@Slf4j
@RestController
@RequestMapping("/app/plainType")
@Module("${cfg.module}")
@Api(value = "飞机型号表API", tags = {"飞机型号表"})
public class PlainTypeController extends BaseController {
@Autowired
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.getAppPlainTypePageList();
Map<Integer, List<PlainType>> resultMap;
List<PlainTypeBo> plainTypeBoList = new ArrayList<>();
if (!CollectionUtils.isEmpty(plainTypeList)) {
resultMap = plainTypeList.stream().collect(Collectors.groupingBy(PlainType::getSeriesType));
PlainTypeBo plainTypeBo;
for (List<PlainType> listTemp: resultMap.values()) {
plainTypeBo = new PlainTypeBo();
plainTypeBo.setType(listTemp.get(0).getSeriesType())
.setPlainTypeList(listTemp);
plainTypeBoList.add(plainTypeBo);
}
}
return ApiResult.ok(plainTypeBoList);
}
}
package com.jumeirah.api.app.controller;
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.log.annotation.OperationLog;
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.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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 优惠行程表 控制器
*
* @author xxx
* @since 2020-10-14
*/
@Slf4j
@RestController
@RequestMapping("/app/strokeDiscount")
@Api(value = "优惠行程表API", tags = {"优惠行程表"})
public class StrokeDiscountController extends BaseController {
@Autowired
private StrokeDiscountService strokeDiscountService;
/**
* 优惠行程表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "优惠行程表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "优惠行程表分页列表")
public ApiResult<Paging<StrokeDiscountQueryVo>> getStrokeDiscountPageList(@Validated @RequestBody StrokeDiscountPageParam strokeDiscountPageParam) throws Exception {
Paging<StrokeDiscountQueryVo> paging = strokeDiscountService.getAppStrokeDiscountPageList(strokeDiscountPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.common.entity.SysNotice;
import com.jumeirah.common.entity.SysNoticeRead;
import com.jumeirah.common.param.SysNoticeQueryVo;
import com.jumeirah.common.service.SysNoticeReadService;
import com.jumeirah.common.service.SysNoticeService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* 系统通知表 控制器
*
* @author xxx
* @since 2020-11-06
*/
@Slf4j
@RestController
@RequestMapping("/app/sysNotice")
@Api(value = "系统通知表API", tags = {"系统通知表"})
public class SysNoticeController extends BaseController {
@Autowired
private SysNoticeService sysNoticeService;
@Autowired
private SysNoticeReadService sysNoticeReadService;
@PostMapping("/getList")
@OperationLog(name = "系统通知表列表", type = OperationLogType.PAGE)
@ApiOperation(value = "系统通知表列表")
public ApiResult<List<SysNoticeQueryVo>> list() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
List<SysNotice> list = sysNoticeService.list();
List<SysNoticeQueryVo> sysNoticeQueryVoList = new ArrayList<>();
for (SysNotice sysNotice : list) {
SysNoticeQueryVo sysNoticeQueryVo = new SysNoticeQueryVo();
sysNoticeQueryVo.setId(sysNotice.getId());
sysNoticeQueryVo.setTheme(sysNotice.getTheme());
sysNoticeQueryVo.setMsgInfo(sysNotice.getContent());
sysNoticeQueryVo.setSendTime(sysNotice.getCreateTime());
sysNoticeQueryVoList.add(sysNoticeQueryVo);
}
// 修改为已读
SysNoticeRead sysNoticeRead = sysNoticeReadService.getOne(new QueryWrapper<SysNoticeRead>().lambda()
.eq(SysNoticeRead::getUserId, jwtToken.getUserId()));
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);
}
//
// /**
// * 添加系统通知表
// */
// @PostMapping("/add")
// @OperationLog(name = "添加系统通知表", type = OperationLogType.ADD)
// @ApiOperation(value = "添加系统通知表")
// public ApiResult<Boolean> addSysNotice(@Validated(Add.class) @RequestBody SysNotice sysNotice) throws Exception {
// boolean flag = sysNoticeService.saveSysNotice(sysNotice);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改系统通知表
// */
// @PostMapping("/update")
// @OperationLog(name = "修改系统通知表", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改系统通知表")
// public ApiResult<Boolean> updateSysNotice(@Validated(Update.class) @RequestBody SysNotice sysNotice) throws Exception {
// boolean flag = sysNoticeService.updateSysNotice(sysNotice);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除系统通知表
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除系统通知表", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除系统通知表")
// public ApiResult<Boolean> deleteSysNotice(@PathVariable("id") Long id) throws Exception {
// boolean flag = sysNoticeService.deleteSysNotice(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取系统通知表详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "系统通知表详情", type = OperationLogType.INFO)
// @ApiOperation(value = "系统通知表详情")
// public ApiResult<SysNoticeQueryVo> getSysNotice(@PathVariable("id") Long id) throws Exception {
// SysNoticeQueryVo sysNoticeQueryVo = sysNoticeService.getSysNoticeById(id);
// return ApiResult.ok(sysNoticeQueryVo);
// }
/**
* 系统通知表分页列表
*/
// @PostMapping("/getPageList")
// @OperationLog(name = "系统通知表分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "系统通知表分页列表")
// public ApiResult<Paging<SysNoticeQueryVo>> getSysNoticePageList(@Validated @RequestBody SysNoticePageParam sysNoticePageParam) throws Exception {
// Paging<SysNoticeQueryVo> paging = sysNoticeService.getSysNoticePageList(sysNoticePageParam);
// return ApiResult.ok(paging);
// }
}
package com.jumeirah.api.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.common.entity.SysNoticeRead;
import com.jumeirah.common.param.SysNoticeReadQueryVo;
import com.jumeirah.common.service.SysNoticeReadService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 系统通知已读 未读 控制器
*
* @author xxx
* @since 2020-11-06
*/
@Slf4j
@RestController
@RequestMapping("/app/sysNoticeRead")
@Api(value = "系统通知已读 未读API", tags = {"系统通知已读 未读"})
public class SysNoticeReadController extends BaseController {
@Autowired
private SysNoticeReadService sysNoticeReadService;
/**
* 获取系统通知已读 未读详情
*/
@GetMapping("/getNoticeReadByUser")
@OperationLog(name = "用户是否已读系统通知", type = OperationLogType.INFO)
@ApiOperation(value = "用户是否已读系统通知")
public ApiResult<SysNoticeReadQueryVo> getSysNoticeReadByUser() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
SysNoticeRead one = sysNoticeReadService.getOne(
new QueryWrapper<SysNoticeRead>().lambda().eq(SysNoticeRead::getUserId, jwtToken.getUserId()));
SysNoticeReadQueryVo sysNoticeReadQueryVo = new SysNoticeReadQueryVo();
if (null == one) {
SysNoticeRead sysNoticeRead = new SysNoticeRead();
sysNoticeRead.setUserId(jwtToken.getUserId());
sysNoticeRead.setReadStatus(0);
sysNoticeReadService.save(sysNoticeRead);
sysNoticeReadQueryVo.setRead(0);
} else {
sysNoticeReadQueryVo.setRead(one.getReadStatus());
}
return ApiResult.ok(sysNoticeReadQueryVo);
}
// /**
// * 添加系统通知已读 未读
// */
// @PostMapping("/add")
// @OperationLog(name = "添加系统通知已读 未读", type = OperationLogType.ADD)
// @ApiOperation(value = "添加系统通知已读 未读")
// public ApiResult<Boolean> addSysNoticeRead(@Validated(Add.class) @RequestBody SysNoticeRead sysNoticeRead)throws Exception{
// boolean flag= sysNoticeReadService.saveSysNoticeRead(sysNoticeRead);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改系统通知已读 未读
// */
// @PostMapping("/update")
// @OperationLog(name = "修改系统通知已读 未读", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改系统通知已读 未读")
// public ApiResult<Boolean> updateSysNoticeRead(@Validated(Update.class) @RequestBody SysNoticeRead sysNoticeRead)throws Exception{
// boolean flag= sysNoticeReadService.updateSysNoticeRead(sysNoticeRead);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除系统通知已读 未读
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除系统通知已读 未读", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除系统通知已读 未读")
// public ApiResult<Boolean> deleteSysNoticeRead(@PathVariable("id") Long id)throws Exception{
// boolean flag= sysNoticeReadService.deleteSysNoticeRead(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取系统通知已读 未读详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "系统通知已读 未读详情", type = OperationLogType.INFO)
// @ApiOperation(value = "系统通知已读 未读详情")
// public ApiResult<SysNoticeReadQueryVo> getSysNoticeRead(@PathVariable("id") Long id)throws Exception{
// SysNoticeReadQueryVo sysNoticeReadQueryVo = sysNoticeReadService.getSysNoticeReadById(id);
// return ApiResult.ok(sysNoticeReadQueryVo);
// }
// /**
// * 系统通知已读 未读分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "系统通知已读 未读分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "系统通知已读 未读分页列表")
// public ApiResult<Paging<SysNoticeReadQueryVo>>getSysNoticeReadPageList(@Validated @RequestBody SysNoticeReadPageParam sysNoticeReadPageParam)throws Exception{
// Paging<SysNoticeReadQueryVo> paging = sysNoticeReadService.getSysNoticeReadPageList(sysNoticeReadPageParam);
// return ApiResult.ok(paging);
// }
}
package com.jumeirah.api.app.controller;
import com.jumeirah.common.entity.UserActiveRecord;
import com.jumeirah.common.service.UserActiveRecordService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* app用户活跃记录表 控制器
*
* @author giao
* @since 2020-10-21
*/
@Slf4j
@RestController
@RequestMapping("/app/userActiveRecord")
@Api(value = "app用户活跃记录表API", tags = {"app用户活跃记录表"})
public class UserActiveRecordController extends BaseController {
@Autowired
private UserActiveRecordService userActiveRecordService;
/**
* 添加app用户活跃记录表
*/
@PostMapping("/add")
@OperationLog(name = "添加app用户活跃记录表", type = OperationLogType.ADD)
@ApiOperation(value = "添加app用户活跃记录表")
public ApiResult<Boolean> addUserActiveRecord() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
UserActiveRecord userActiveRecord = new UserActiveRecord();
userActiveRecord.setUserId(jwtToken.getUserId());
userActiveRecord.setRecordDate(new Date());
boolean flag = userActiveRecordService.saveUserActiveRecord(userActiveRecord);
return ApiResult.result(flag);
}
//
// /**
// * 修改app用户活跃记录表
// */
// @PostMapping("/update")
// @OperationLog(name = "修改app用户活跃记录表", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改app用户活跃记录表")
// public ApiResult<Boolean> updateUserActiveRecord(@Validated(Update.class) @RequestBody UserActiveRecord userActiveRecord)throws Exception{
// boolean flag= userActiveRecordService.updateUserActiveRecord(userActiveRecord);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除app用户活跃记录表
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除app用户活跃记录表", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除app用户活跃记录表")
// public ApiResult<Boolean> deleteUserActiveRecord(@PathVariable("id") Long id)throws Exception{
// boolean flag= userActiveRecordService.deleteUserActiveRecord(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取app用户活跃记录表详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "app用户活跃记录表详情", type = OperationLogType.INFO)
// @ApiOperation(value = "app用户活跃记录表详情")
// public ApiResult<UserActiveRecordQueryVo> getUserActiveRecord(@PathVariable("id") Long id)throws Exception{
// UserActiveRecordQueryVo userActiveRecordQueryVo = userActiveRecordService.getUserActiveRecordById(id);
// return ApiResult.ok(userActiveRecordQueryVo);
// }
//
// /**
// * app用户活跃记录表分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "app用户活跃记录表分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "app用户活跃记录表分页列表")
// public ApiResult<Paging<UserActiveRecordQueryVo>>getUserActiveRecordPageList(@Validated @RequestBody UserActiveRecordPageParam userActiveRecordPageParam)throws Exception{
// Paging<UserActiveRecordQueryVo> paging = userActiveRecordService.getUserActiveRecordPageList(userActiveRecordPageParam);
// return ApiResult.ok(paging);
// }
//
}
package com.jumeirah.api.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.common.entity.VersionControl;
import com.jumeirah.common.service.VersionControlService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* App版本控制 控制器
* <p>
* 仅查询最新创建的一条版本数据返回给App
*
* @author giao
* @since 2020-10-26
*/
@Slf4j
@RestController
@RequestMapping("/app/versionControl")
@Api(value = "App版本控制API", tags = {"App版本控制"})
public class VersionControlController extends BaseController {
@Autowired
private VersionControlService versionControlService;
// /**
// * 添加App版本控制
// */
// @PostMapping("/add")
// @OperationLog(name = "添加App版本控制", type = OperationLogType.ADD)
// @ApiOperation(value = "添加App版本控制")
// public ApiResult<Boolean> addVersionControl(@Validated(Add.class) @RequestBody VersionControl versionControl) throws Exception {
// boolean flag = versionControlService.saveVersionControl(versionControl);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改App版本控制
// */
// @PostMapping("/update")
// @OperationLog(name = "修改App版本控制", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改App版本控制")
// public ApiResult<Boolean> updateVersionControl(@Validated(Update.class) @RequestBody VersionControl versionControl) throws Exception {
// boolean flag = versionControlService.updateVersionControl(versionControl);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除App版本控制
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除App版本控制", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除App版本控制")
// public ApiResult<Boolean> deleteVersionControl(@PathVariable("id") Long id) throws Exception {
// boolean flag = versionControlService.deleteVersionControl(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取App版本控制详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "App版本控制详情", type = OperationLogType.INFO)
// @ApiOperation(value = "App版本控制详情")
// public ApiResult<VersionControlQueryVo> getVersionControl(@PathVariable("id") Long id) throws Exception {
// VersionControlQueryVo versionControlQueryVo = versionControlService.getVersionControlById(id);
// return ApiResult.ok(versionControlQueryVo);
// }
//
// /**
// * App版本控制分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "App版本控制分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "App版本控制分页列表")
// public ApiResult<Paging<VersionControlQueryVo>> getVersionControlPageList(@Validated @RequestBody VersionControlPageParam versionControlPageParam) throws Exception {
// Paging<VersionControlQueryVo> paging = versionControlService.getVersionControlPageList(versionControlPageParam);
// return ApiResult.ok(paging);
// }
/**
* 获取最新一条版本记录
*/
@GetMapping("/lastOne/{type}")
// @OperationLog(name = "获取最新一条版本记录", type = OperationLogType.INFO)
@ApiOperation(value = "获取最新一条版本记录")
public ApiResult<VersionControl> lastOne(@PathVariable Integer type) throws Exception {
VersionControl versionControlQueryVo = versionControlService.getOne(
new QueryWrapper<VersionControl>().lambda()
.eq(VersionControl::getDeviceType, type)
.orderByDesc(VersionControl::getCreateTime).last("limit 1")
);
return ApiResult.ok(versionControlQueryVo);
}
}
package com.jumeirah.api.app.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.sql.Timestamp;
/**
* 行程表-返程
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "添加返程行程入参对象")
public class StrokeAddBackAndForthParam 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 peopleNum;
@ApiModelProperty("用户选择机型(多个中间逗号隔开)")
private String choosePlainType;
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Timestamp outsetTime;
@NotNull(message = "返程时间不能为空")
@ApiModelProperty("返程时间")
private Timestamp returnTime;
}
package com.jumeirah.api.app.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.NotBlank;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "添加货运行程入参对象")
public class StrokeAddFreightParam 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 Timestamp outsetTime;
@NotBlank(message = "货物名称不能为空")
@ApiModelProperty("货物名称")
private String goodsName;
@NotBlank(message = "货物体积不能为空")
@ApiModelProperty("货物体积(长*宽*高) 单位:CM,例如:100*102*120")
private String goodsSize;
@NotNull(message = "货物重量不能为空")
@ApiModelProperty("货物重量,单位:吨")
private String goodsWeight;
}
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;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
import java.util.List;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "添加医疗行程入参对象")
public class StrokeAddMedicalTreatmentParam 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 Timestamp outsetTime;
@NotBlank(message = "到达城市名称不能为空")
@ApiModelProperty("病人疾病名称")
private String diseaseName;
@ApiModelProperty("病人病情诊断书")
private List<ImgJson> 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.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.sql.Timestamp;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "添加单程行程入参对象")
public class StrokeAddOneWayParam 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 peopleNum;
@ApiModelProperty("用户选择机型(多个中间逗号隔开)")
private String choosePlainType;
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Timestamp outsetTime;
}
package com.jumeirah.api.app.controller; package com.sien.api.app.controller;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog; import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
...@@ -20,7 +20,6 @@ import java.io.IOException; ...@@ -20,7 +20,6 @@ import java.io.IOException;
@Api(value = "权限测试", tags = {"APP Hello World2"}) @Api(value = "权限测试", tags = {"APP Hello World2"})
@RestController @RestController
@RequestMapping("/app") @RequestMapping("/app")
//@Module("api-app")
public class AppHelloWorldController { public class AppHelloWorldController {
/** /**
......
package com.jumeirah.api.app.controller; package com.sien.api.app.controller;
import com.jumeirah.api.app.service.AppSmsService; import com.sien.api.app.service.AppSmsService;
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.log.annotation.OperationLog; import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
...@@ -38,19 +38,20 @@ public class AppSmsController extends BaseController { ...@@ -38,19 +38,20 @@ public class AppSmsController extends BaseController {
@ApiOperation(value = "获取注册或登陆的验证码", response = Object.class, notes = "本地环境默认666666") @ApiOperation(value = "获取注册或登陆的验证码", response = Object.class, notes = "本地环境默认666666")
public ApiResult<Object> registerOrLoginCode(@RequestParam String phoneArea, @RequestParam String phone) throws Exception { public ApiResult<Object> registerOrLoginCode(@RequestParam String phoneArea, @RequestParam String phone) throws Exception {
// , @RequestParam(required = false) String openid
return appSmsService.registerOrLoginCode(phoneArea, phone); return appSmsService.registerOrLoginCode(phoneArea, phone);
} }
/** // /**
* 获取修改手机号的验证码 // * 获取修改手机号的验证码
*/ // */
@GetMapping("/updatePhoneCode") // @GetMapping("/updatePhoneCode")
@OperationLog(name = "获取修改手机号的验证码", type = OperationLogType.INFO) // @OperationLog(name = "获取修改手机号的验证码", type = OperationLogType.INFO)
@ApiOperation(value = "获取修改手机号的验证码", response = Object.class, notes = "本地环境默认666666") // @ApiOperation(value = "获取修改手机号的验证码", response = Object.class, notes = "本地环境默认666666")
public ApiResult<Object> updatePhoneCode() throws Exception { // public ApiResult<Object> updatePhoneCode() throws Exception {
//
return appSmsService.updatePhoneCode(); // return appSmsService.updatePhoneCode();
} // }
} }
package com.jumeirah.api.app.controller; package com.sien.api.app.controller;
import com.jumeirah.api.app.service.AppUserApiService; import com.sien.api.app.service.AppUserApiService;
import com.jumeirah.common.entity.AppUser; import com.sien.common.param.app.AppSmsRegisterParam;
import com.jumeirah.common.param.app.AppSmsRegisterParam; import com.sien.common.param.app.AppUserInfoParam;
import com.jumeirah.common.param.app.AppUserInfoParam; import com.sien.common.param.app.AppUserPhoneUpdateParam;
import com.jumeirah.common.param.app.AppUserPhoneUpdateParam; import com.sien.common.vo.app.LoginAppUserTokenVo;
import com.jumeirah.common.param.app.DeviceTokenParam;
import com.jumeirah.common.service.AppUserService;
import com.jumeirah.common.vo.app.LoginAppUserTokenVo;
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.log.annotation.Module; import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog; import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType; import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil;
import io.geekidea.springbootplus.framework.shiro.util.JwtUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Set;
/** /**
* APP用户 控制器 * APP用户 控制器
...@@ -45,24 +34,18 @@ import java.util.Set; ...@@ -45,24 +34,18 @@ import java.util.Set;
@RequestMapping("/app/user/") @RequestMapping("/app/user/")
public class AppUserController extends BaseController { public class AppUserController extends BaseController {
@Autowired // @Autowired
private AppUserService appUserService; // private AppUserService appUserService;
@Autowired @Autowired
private AppUserApiService appUserApiService; private AppUserApiService appUserApiService;
/** @PostMapping("/registerOrLogin")
* 添加或修改推送token @ApiOperation(value = "手机号注册+登陆", notes = "app用户注册+登陆", response = LoginAppUserTokenVo.class)
*/ public ApiResult<LoginAppUserTokenVo> registerOrLogin(@Validated @RequestBody AppSmsRegisterParam appSmsRegisterParam, @RequestHeader(required = false) String language) throws Exception {
@PostMapping("/addDeviceToken") return appUserApiService.register(appSmsRegisterParam, language);
@OperationLog(name = "添加或修改推送token", type = OperationLogType.ADD)
@ApiOperation(value = "添加或修改推送token", notes = "添加和修改都调用此接口", response = ApiResult.class)
public ApiResult<Boolean> addDeviceToken(@RequestBody DeviceTokenParam deviceTokenParam) throws Exception {
boolean flag = appUserService.updateDeviceToken(deviceTokenParam, deviceTokenParam.getDeviceType());
return ApiResult.result(flag);
} }
/** /**
* 补充或修改APP用户信息 * 补充或修改APP用户信息
*/ */
...@@ -85,6 +68,42 @@ public class AppUserController extends BaseController { ...@@ -85,6 +68,42 @@ public class AppUserController extends BaseController {
return appUserApiService.updatePhone(userPhoneUpdateParam.getPhoneArea(), userPhoneUpdateParam.getPhone(), userPhoneUpdateParam.getCode()); return appUserApiService.updatePhone(userPhoneUpdateParam.getPhoneArea(), userPhoneUpdateParam.getPhone(), userPhoneUpdateParam.getCode());
} }
// @GetMapping("/userInfoList")
// @ApiOperation(value = "批量获取用户信息")
// public ApiResult<List<AppUser>> getUserInfoList(@RequestParam("uids") Set<Long> uids) {
// return appUserApiService.getAppUserList(uids);
// }
/**
* APP用户分页列表
*//*
@PostMapping("/getPageList")
@OperationLog(name = "APP用户分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "APP用户分页列表", response = AppUserQueryVo.class)
@RequiresRoles("sys:admin")
public ApiResult<Paging<AppUserQueryVo>> getAppUserPageList(@Validated @RequestBody AppUserPageParam appUserPageParam) throws Exception {
Paging<AppUserQueryVo> paging = appUserService.getAppUserPageList(appUserPageParam);
return ApiResult.ok(paging);
}*/
// @GetMapping("/userInfo")
// @ApiOperation(value = "根据token获取userInfo", notes = "客服模块调用")
// public AppUser getUserInfo() {
// return appUserApiService.getUserInfo(Long.valueOf(JwtUtil.getUsername(JwtTokenUtil.getToken())));
// }
// /**
// * 添加或修改推送token
// */
// @PostMapping("/addDeviceToken")
// @OperationLog(name = "添加或修改推送token", type = OperationLogType.ADD)
// @ApiOperation(value = "添加或修改推送token", notes = "添加和修改都调用此接口", response = ApiResult.class)
// public ApiResult<Boolean> addDeviceToken(@RequestBody DeviceTokenParam deviceTokenParam) throws Exception {
// boolean flag = appUserService.updateDeviceToken(deviceTokenParam, deviceTokenParam.getDeviceType());
// return ApiResult.result(flag);
// }
/* *//** /* *//**
* 添加APP用户 * 添加APP用户
*//* *//*
...@@ -135,34 +154,6 @@ public class AppUserController extends BaseController { ...@@ -135,34 +154,6 @@ public class AppUserController extends BaseController {
*/ */
/**
* APP用户分页列表
*//*
@PostMapping("/getPageList")
@OperationLog(name = "APP用户分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "APP用户分页列表", response = AppUserQueryVo.class)
@RequiresRoles("sys:admin")
public ApiResult<Paging<AppUserQueryVo>> getAppUserPageList(@Validated @RequestBody AppUserPageParam appUserPageParam) throws Exception {
Paging<AppUserQueryVo> paging = appUserService.getAppUserPageList(appUserPageParam);
return ApiResult.ok(paging);
}*/
@PostMapping("/registerOrLogin")
@ApiOperation(value = "手机号注册+登陆", notes = "app用户注册+登陆", response = LoginAppUserTokenVo.class)
public ApiResult<LoginAppUserTokenVo> registerOrLogin(@Validated @RequestBody AppSmsRegisterParam appSmsRegisterParam, @RequestHeader(required = false) String language) throws Exception {
return appUserApiService.register(appSmsRegisterParam, language);
}
@GetMapping("/userInfo")
@ApiOperation(value = "根据token获取userInfo", notes = "客服模块调用")
public AppUser getUserInfo() {
return appUserApiService.getUserInfo(Long.valueOf(JwtUtil.getUsername(JwtTokenUtil.getToken())));
}
@GetMapping("/userInfoList")
@ApiOperation(value = "批量获取用户信息")
public ApiResult<List<AppUser>> getUserInfoList(@RequestParam("uids") Set<Long> uids) {
return appUserApiService.getAppUserList(uids);
}
} }
package com.jumeirah.api.app.entity.bo; package com.sien.api.app.entity.bo;
import com.jumeirah.common.entity.PlainType; import com.sien.common.entity.PlainType;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity; import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.jumeirah.api.app.entity.param; package com.sien.api.app.entity.param;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity; import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
......
package com.jumeirah.api.app.entity.param; package com.sien.api.app.entity.param;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity; import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
......
package com.jumeirah.api.app.service; package com.sien.api.app.service;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
...@@ -12,7 +12,7 @@ public interface AppSmsService { ...@@ -12,7 +12,7 @@ public interface AppSmsService {
* 获取注册验证码 * 获取注册验证码
*/ */
ApiResult<Object> registerOrLoginCode(String phoneArea, String phone); ApiResult<Object> registerOrLoginCode(String phoneArea, String phone);
ApiResult<Object> updatePhoneCode() throws Exception; // ApiResult<Object> updatePhoneCode() throws Exception;
/** /**
* 获取注册验证码 * 获取注册验证码
......
package com.jumeirah.api.app.service; package com.sien.api.app.service;
import com.jumeirah.common.entity.AppUser; import com.sien.common.param.app.AppSmsRegisterParam;
import com.jumeirah.common.param.app.AppSmsRegisterParam; import com.sien.common.param.app.AppUserInfoParam;
import com.jumeirah.common.param.app.AppUserInfoParam; import com.sien.common.vo.app.LoginAppUserTokenVo;
import com.jumeirah.common.vo.app.LoginAppUserTokenVo; import com.sien.common.entity.AppUser;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import java.util.List; import java.util.List;
......
package com.jumeirah.api.app.service.impl; package com.sien.api.app.service.impl;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.jumeirah.api.app.service.AppSmsService; import com.sien.api.app.service.AppSmsService;
import com.jumeirah.api.app.vo.SmsCode; import com.sien.api.app.vo.SmsCode;
import com.jumeirah.common.service.AppUserService; import com.sien.common.service.AppUserService;
import com.jumeirah.common.vo.AppUserQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -74,14 +71,24 @@ public class AppSmsServiceImpl implements AppSmsService { ...@@ -74,14 +71,24 @@ public class AppSmsServiceImpl implements AppSmsService {
return getSmsCodeApiResult(String.format(SMS_REGIEST, area, number), area, number); return getSmsCodeApiResult(String.format(SMS_REGIEST, area, number), area, number);
} }
@Override // @Override
public ApiResult<Object> updatePhoneCode() throws Exception { // public ApiResult<Object> updatePhoneCode() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); // JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
AppUserQueryVo appUserById = appUserService.getAppUserById(jwtToken.getUserId()); // AppUserQueryVo appUserById = appUserService.getAppUserById(jwtToken.getUserId());
return getSmsCodeApiResult(String.format(SMS_UPDATE, appUserById.getPhoneArea(), appUserById.getPhone()), appUserById.getPhoneArea(), appUserById.getPhone()); // return getSmsCodeApiResult(String.format(SMS_UPDATE, appUserById.getPhoneArea(), appUserById.getPhone()), appUserById.getPhoneArea(), appUserById.getPhone());
} // }
/**
* 获取短信验证码
*
* @param key
* @param area
* @param number
* @return
*/
private ApiResult<Object> getSmsCodeApiResult(String key, String area, String number) { private ApiResult<Object> getSmsCodeApiResult(String key, String area, String number) {
// 生成验证码code
String randomCode = getRandomCode(); String randomCode = getRandomCode();
// 过期时间(秒) // 过期时间(秒)
......
package com.jumeirah.api.app.service.impl; package com.sien.api.app.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.api.app.service.AppSmsService; import com.sien.api.app.service.AppSmsService;
import com.jumeirah.api.app.service.AppUserApiService; import com.sien.api.app.service.AppUserApiService;
import com.jumeirah.common.entity.AppUser; import com.sien.common.param.app.AppSmsRegisterParam;
import com.jumeirah.common.param.app.AppSmsRegisterParam; import com.sien.common.param.app.AppUserInfoParam;
import com.jumeirah.common.param.app.AppUserInfoParam; import com.sien.common.service.AppUserService;
import com.jumeirah.common.service.AppUserService; import com.sien.common.vo.app.LoginAppUserTokenVo;
import com.jumeirah.common.vo.AppUserQueryVo; import com.sien.common.entity.AppUser;
import com.jumeirah.common.vo.app.LoginAppUserTokenVo;
import io.geekidea.springbootplus.framework.common.api.ApiCode; import io.geekidea.springbootplus.framework.common.api.ApiCode;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken; import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
...@@ -32,36 +31,36 @@ public class AppUserApiServiceImpl implements AppUserApiService { ...@@ -32,36 +31,36 @@ public class AppUserApiServiceImpl implements AppUserApiService {
@Override @Override
public ApiResult<Boolean> updatePhone(String phoneArea, String phone, String code) throws Exception { public ApiResult<Boolean> updatePhone(String phoneArea, String phone, String code) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); // JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
//
AppUserQueryVo appUserById = appUserService.getAppUserById(jwtToken.getUserId()); // AppUserQueryVo appUserById = appUserService.getAppUserById(jwtToken.getUserId());
//
// 校验验证码 // // 校验验证码
boolean equalsRegisterCode = appSmsService.equalsUpdatePhoneCode(appUserById.getPhoneArea(), appUserById.getPhone(), code); // boolean equalsRegisterCode = appSmsService.equalsUpdatePhoneCode(appUserById.getPhoneArea(), appUserById.getPhone(), code);
if (!equalsRegisterCode) { // if (!equalsRegisterCode) {
return ApiResult.fail(ApiCode.SMS_CODE_ERROR); // return ApiResult.fail(ApiCode.SMS_CODE_ERROR);
} // }
// 删除已使用的验证码 // // 删除已使用的验证码
appSmsService.deleteUpdatePhoneCode(appUserById.getPhoneArea(), appUserById.getPhone()); // appSmsService.deleteUpdatePhoneCode(appUserById.getPhoneArea(), appUserById.getPhone());
//
// 判断手机号是否已经注册 // // 判断手机号是否已经注册
AppUser one = appUserService.getOne(new QueryWrapper<AppUser>().lambda() // AppUser one = appUserService.getOne(new QueryWrapper<AppUser>().lambda()
.eq(AppUser::getPhoneArea, phoneArea) // .eq(AppUser::getPhoneArea, phoneArea)
.eq(AppUser::getPhone, phone)); // .eq(AppUser::getPhone, phone));
if (one != null) { // if (one != null) {
return ApiResult.fail(ApiCode.BUSINESS_EXCEPTION); // return ApiResult.fail(ApiCode.BUSINESS_EXCEPTION);
} // }
//
//
AppUser appUser = new AppUser(); // AppUser appUser = new AppUser();
appUser.setPhoneArea(phoneArea); // appUser.setPhoneArea(phoneArea);
appUser.setPhone(phone); // appUser.setPhone(phone);
appUser.setId(jwtToken.getUserId()); // appUser.setId(jwtToken.getUserId());
//
boolean b = appUserService.updateById(appUser); // boolean b = appUserService.updateById(appUser);
if (b) { // if (b) {
return ApiResult.ok(); // return ApiResult.ok();
} // }
return ApiResult.fail(); return ApiResult.fail();
} }
...@@ -94,6 +93,7 @@ public class AppUserApiServiceImpl implements AppUserApiService { ...@@ -94,6 +93,7 @@ public class AppUserApiServiceImpl implements AppUserApiService {
AppUser appUser = new AppUser(); AppUser appUser = new AppUser();
appUser.setPhoneArea(loginParam.getPhoneArea()); appUser.setPhoneArea(loginParam.getPhoneArea());
appUser.setPhone(loginParam.getPhone()); appUser.setPhone(loginParam.getPhone());
appUser.setWechatOpenId(loginParam.getOpenid());
boolean isDbOk = appUserService.saveAppUser(appUser); boolean isDbOk = appUserService.saveAppUser(appUser);
if (!isDbOk) { if (!isDbOk) {
return ApiResult.fail(ApiCode.SPRING_BOOT_PLUS_EXCEPTION, new LoginAppUserTokenVo()); return ApiResult.fail(ApiCode.SPRING_BOOT_PLUS_EXCEPTION, new LoginAppUserTokenVo());
......
package com.jumeirah.api.app.vo; package com.sien.api.app.vo;
import lombok.Data; import lombok.Data;
......
/target/
/classes
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
.DS_Store
*.log
logs
*.rdb
# system 项目系统模块
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.geekidea.springbootplus</groupId>
<artifactId>parent</artifactId>
<version>2.0</version>
</parent>
<artifactId>api-merchant</artifactId>
<name>api-merchant</name>
<description>商家api服务模块</description>
<dependencies>
<dependency>
<groupId>io.geekidea.springbootplus</groupId>
<artifactId>framework</artifactId>
</dependency>
<dependency>
<groupId>io.geekidea.springbootplus</groupId>
<artifactId>common</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.jumeirah.api.merchant.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.common.entity.CharterIntroduction;
import com.jumeirah.common.param.CharterIntroductionAddParam;
import com.jumeirah.common.param.CharterIntroductionUpdateParam;
import com.jumeirah.common.service.CharterIntroductionService;
import com.jumeirah.common.vo.CharterIntroductionQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.factory.annotation.Autowired;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 包机介绍 控制器
*
* @author giao
* @since 2020-10-14
*/
@Slf4j
@RestController
@RequestMapping("/merchant/charterIntroduction")
@Api(value = "包机介绍API", tags = {"包机介绍"})
public class CharterIntroductionForMerController extends BaseController {
@Autowired
private CharterIntroductionService charterIntroductionService;
/**
* 添加包机介绍
*/
@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);
}
/**
* 修改包机介绍
*/
@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);
}
/**
* 删除包机介绍
*/
@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);
}
/**
* 获取包机介绍详情
*/
@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);
}
/**
* 包机介绍分页列表
*/
@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();
List<CharterIntroduction> list = charterIntroductionService.list(
new QueryWrapper<CharterIntroduction>().lambda().eq(CharterIntroduction::getMcId, jwtToken.getMcId()));
return ApiResult.ok(list);
}
}
package com.jumeirah.api.merchant.controller;
import com.jumeirah.api.merchant.entity.param.ContactStaffParam;
import com.jumeirah.common.entity.ContactStaff;
import com.jumeirah.common.param.ContactStaffPageParam;
import com.jumeirah.common.param.ContactStaffQueryVo;
import com.jumeirah.common.service.ContactStaffService;
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.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.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;
import java.sql.Timestamp;
/**
* 控制器
*
* @author xxx
* @since 2020-10-27
*/
@Slf4j
@RestController
@RequestMapping("/merchant/contactStaff")
@Api(value = "客服信息表API", tags = {"客服信息"})
public class ContactStaffController extends BaseController {
@Autowired
private ContactStaffService contactStaffService;
/**
* 添加
*/
@PostMapping("/add")
@OperationLog(name = "添加", type = OperationLogType.ADD)
@ApiOperation(value = "添加")
public ApiResult<Boolean> addContactStaff(@Validated(Add.class) @RequestBody ContactStaffParam contactStaffParam) throws Exception {
ContactStaff contactStaff = new ContactStaff();
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
contactStaff.setPhone(contactStaffParam.getPhone())
.setMcId(jwtToken.getMcId());
boolean flag = contactStaffService.saveContactStaff(contactStaff);
return ApiResult.result(flag);
}
/**
* 修改
*/
@PostMapping("/update")
@OperationLog(name = "修改", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改")
public ApiResult<Boolean> updateContactStaff(@Validated(Update.class) @RequestBody ContactStaffParam contactStaffParam) throws Exception {
ContactStaff contactStaff = new ContactStaff();
contactStaff.setId(contactStaffParam.getId())
.setPhone(contactStaffParam.getPhone())
.setUpdateTime(new Timestamp(System.currentTimeMillis()));
boolean flag = contactStaffService.updateContactStaff(contactStaff);
return ApiResult.result(flag);
}
/**
* 删除
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除", type = OperationLogType.DELETE)
@ApiOperation(value = "删除")
public ApiResult<Boolean> deleteContactStaff(@PathVariable("id") Long id) throws Exception {
boolean flag = contactStaffService.deleteContactStaff(id);
return ApiResult.result(flag);
}
/**
* 分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "分页列表")
public ApiResult<Paging<ContactStaffQueryVo>> getContactStaffPageList(@Validated @RequestBody ContactStaffPageParam contactStaffPageParam) throws Exception {
Paging<ContactStaffQueryVo> paging = contactStaffService.getContactStaffPageList(contactStaffPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.merchant.controller;
import com.jumeirah.api.merchant.entity.param.McAppUserParam;
import com.jumeirah.common.entity.AppUser;
import com.jumeirah.common.service.AppUserService;
import com.jumeirah.common.vo.AppUserQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* APP用户 控制器
*
* @author wei
* @since 2020-09-23
*/
@Slf4j
@RestController
@Module("api-app")
@Api(value = "app用户API", tags = {"APP用户相关"})
@RequestMapping("/merchant/appUser/")
public class McAppUserController extends BaseController {
@Autowired
private AppUserService appUserService;
/**
* APP用户分页列表
*/
@PostMapping("/getList")
@OperationLog(name = "APP用户分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "APP用户分页列表", response = AppUserQueryVo.class)
public ApiResult<List<AppUser>> getAppUserPageList(@Validated @RequestBody McAppUserParam mcAppUserParam) throws Exception {
List<AppUser> appUsers = appUserService.listByIds(mcAppUserParam.getIds());
return ApiResult.ok(appUsers);
}
}
package com.jumeirah.api.merchant.controller;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
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.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
/**
* Hello World Controller
**/
@Slf4j
@Api(value = "Hello World2", tags = {"商户Hello World2"})
@RestController
@RequestMapping("/merchant/hello")
public class MerchantHelloWorldController {
@GetMapping(value = "/world")
@OperationLog(name = "helloWorld")
@ApiOperation(value = "Hello World", response = String.class)
public ApiResult<String> helloWorld() throws IOException {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
log.debug("Hello World...app");
return ApiResult.ok("Hello World app merchant");
}
@GetMapping(value = "/needRole")
@OperationLog(name = "needRole")
@ApiOperation(value = "needRole", response = String.class)
public ApiResult<String> needRole() throws IOException {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
log.debug("Hello World...app");
return ApiResult.ok("Hello World app");
}
@GetMapping(value = "/needRoleAdmin")
@OperationLog(name = "needRoleAdmin")
@ApiOperation(value = "needRoleAdmin", response = String.class)
@RequiresPermissions("merchant:admin")
public ApiResult<String> needRoleAdmin() throws IOException {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
log.debug("Hello World...app");
return ApiResult.ok("Hello World needRoleAdmin");
}
@GetMapping(value = "/needRoleAll")
@OperationLog(name = "needRoleAll")
@ApiOperation(value = "needRoleAll", response = String.class)
@RequiresRoles("merchant:all")
public ApiResult<String> needRoleAll() throws IOException {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
log.debug("Hello World...app");
return ApiResult.ok("Hello World needRoleAll");
}
@GetMapping(value = "/noRole")
@OperationLog(name = "noRole")
@ApiOperation(value = "noRole", response = String.class)
public ApiResult<String> noRole() throws IOException {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
log.debug("Hello World...app");
return ApiResult.ok("Hello World app noRole");
}
}
//package com.jumeirah.api.merchant.controller;
//
//import com.jumeirah.common.entity.MerchantPermission;
//import com.jumeirah.common.param.MerchantPermissionPageParam;
//import com.jumeirah.common.service.MerchantPermissionService;
//import com.jumeirah.common.vo.MerchantPermissionQueryVo;
//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.core.validator.groups.Update;
//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.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//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.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * 商家权限 控制器
// *
// * @author wei
// * @since 2020-09-27
// */
//@Slf4j
//@RestController
//@RequestMapping("/merchant/permission")
//@Module("${cfg.module}")
//@Api(value = "商家权限API", tags = {"商家权限"})
//public class MerchantPermissionController extends BaseController {
//
// @Autowired
// private MerchantPermissionService merchantPermissionService;
//
// /**
// * 添加商家权限
// */
// @PostMapping("/add")
// @OperationLog(name = "添加商家权限", type = OperationLogType.ADD)
// @ApiOperation(value = "添加商家权限", response = ApiResult.class)
// public ApiResult<Boolean> addMerchantPermission(@Validated(Add.class) @RequestBody MerchantPermission merchantPermission) throws Exception {
// boolean flag = merchantPermissionService.saveMerchantPermission(merchantPermission);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改商家权限
// */
// @PostMapping("/update")
// @OperationLog(name = "修改商家权限", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改商家权限", response = ApiResult.class)
// public ApiResult<Boolean> updateMerchantPermission(@Validated(Update.class) @RequestBody MerchantPermission merchantPermission) throws Exception {
// boolean flag = merchantPermissionService.updateMerchantPermission(merchantPermission);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除商家权限
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除商家权限", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除商家权限", response = ApiResult.class)
// public ApiResult<Boolean> deleteMerchantPermission(@PathVariable("id") Long id) throws Exception {
// boolean flag = merchantPermissionService.deleteMerchantPermission(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取商家权限详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "商家权限详情", type = OperationLogType.INFO)
// @ApiOperation(value = "商家权限详情", response = MerchantPermissionQueryVo.class)
// public ApiResult<MerchantPermissionQueryVo> getMerchantPermission(@PathVariable("id") Long id) throws Exception {
// MerchantPermissionQueryVo merchantPermissionQueryVo = merchantPermissionService.getMerchantPermissionById(id);
// return ApiResult.ok(merchantPermissionQueryVo);
// }
//
// /**
// * 商家权限分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "商家权限分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "商家权限分页列表", response = MerchantPermissionQueryVo.class)
// public ApiResult<Paging<MerchantPermissionQueryVo>> getMerchantPermissionPageList(@Validated @RequestBody MerchantPermissionPageParam merchantPermissionPageParam) throws Exception {
// Paging<MerchantPermissionQueryVo> paging = merchantPermissionService.getMerchantPermissionPageList(merchantPermissionPageParam);
// return ApiResult.ok(paging);
// }
//
//}
//
//package com.jumeirah.api.merchant.controller;
//
//import com.jumeirah.common.entity.MerchantRole;
//import com.jumeirah.common.param.MerchantRolePageParam;
//import com.jumeirah.common.service.MerchantRoleService;
//import com.jumeirah.common.vo.MerchantRoleQueryVo;
//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.core.validator.groups.Update;
//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.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//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.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * 商家角色 控制器
// *
// * @author wei
// * @since 2020-09-27
// */
//@Slf4j
//@RestController
//@RequestMapping("/merchant/role")
//@Module("${cfg.module}")
//@Api(value = "商家角色API", tags = {"商家角色"})
//public class MerchantRoleController extends BaseController {
//
// @Autowired
// private MerchantRoleService merchantRoleService;
//
// /**
// * 添加商家角色
// */
// @PostMapping("/add")
// @OperationLog(name = "添加商家角色", type = OperationLogType.ADD)
// @ApiOperation(value = "添加商家角色", response = ApiResult.class)
// public ApiResult<Boolean> addMerchantRole(@Validated(Add.class) @RequestBody MerchantRole merchantRole) throws Exception {
// boolean flag = merchantRoleService.saveMerchantRole(merchantRole);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改商家角色
// */
// @PostMapping("/update")
// @OperationLog(name = "修改商家角色", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改商家角色", response = ApiResult.class)
// public ApiResult<Boolean> updateMerchantRole(@Validated(Update.class) @RequestBody MerchantRole merchantRole) throws Exception {
// boolean flag = merchantRoleService.updateMerchantRole(merchantRole);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除商家角色
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除商家角色", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除商家角色", response = ApiResult.class)
// public ApiResult<Boolean> deleteMerchantRole(@PathVariable("id") Long id) throws Exception {
// boolean flag = merchantRoleService.deleteMerchantRole(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取商家角色详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "商家角色详情", type = OperationLogType.INFO)
// @ApiOperation(value = "商家角色详情", response = MerchantRoleQueryVo.class)
// public ApiResult<MerchantRoleQueryVo> getMerchantRole(@PathVariable("id") Long id) throws Exception {
// MerchantRoleQueryVo merchantRoleQueryVo = merchantRoleService.getMerchantRoleById(id);
// return ApiResult.ok(merchantRoleQueryVo);
// }
//
// /**
// * 商家角色分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "商家角色分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "商家角色分页列表", response = MerchantRoleQueryVo.class)
// public ApiResult<Paging<MerchantRoleQueryVo>> getMerchantRolePageList(@Validated @RequestBody MerchantRolePageParam merchantRolePageParam) throws Exception {
// Paging<MerchantRoleQueryVo> paging = merchantRoleService.getMerchantRolePageList(merchantRolePageParam);
// return ApiResult.ok(paging);
// }
//
//}
//
//package com.jumeirah.api.merchant.controller;
//
//import com.jumeirah.common.entity.MerchantRolePermission;
//import com.jumeirah.common.param.MerchantRolePermissionPageParam;
//import com.jumeirah.common.service.MerchantRolePermissionService;
//import com.jumeirah.common.vo.MerchantRolePermissionQueryVo;
//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.core.validator.groups.Update;
//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.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//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.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * 商家角色权限关系 控制器
// *
// * @author wei
// * @since 2020-09-27
// */
//@Slf4j
//@RestController
//@RequestMapping("/merchant/rolePermission")
//@Module("${cfg.module}")
//@Api(value = "商家角色权限关系API", tags = {"商家角色权限关系"})
//public class MerchantRolePermissionController extends BaseController {
//
// @Autowired
// private MerchantRolePermissionService merchantRolePermissionService;
//
// /**
// * 添加商家角色权限关系
// */
// @PostMapping("/add")
// @OperationLog(name = "添加商家角色权限关系", type = OperationLogType.ADD)
// @ApiOperation(value = "添加商家角色权限关系", response = ApiResult.class)
// public ApiResult<Boolean> addMerchantRolePermission(@Validated(Add.class) @RequestBody MerchantRolePermission merchantRolePermission) throws Exception {
// boolean flag = merchantRolePermissionService.saveMerchantRolePermission(merchantRolePermission);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改商家角色权限关系
// */
// @PostMapping("/update")
// @OperationLog(name = "修改商家角色权限关系", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改商家角色权限关系", response = ApiResult.class)
// public ApiResult<Boolean> updateMerchantRolePermission(@Validated(Update.class) @RequestBody MerchantRolePermission merchantRolePermission) throws Exception {
// boolean flag = merchantRolePermissionService.updateMerchantRolePermission(merchantRolePermission);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除商家角色权限关系
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除商家角色权限关系", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除商家角色权限关系", response = ApiResult.class)
// public ApiResult<Boolean> deleteMerchantRolePermission(@PathVariable("id") Long id) throws Exception {
// boolean flag = merchantRolePermissionService.deleteMerchantRolePermission(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取商家角色权限关系详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "商家角色权限关系详情", type = OperationLogType.INFO)
// @ApiOperation(value = "商家角色权限关系详情", response = MerchantRolePermissionQueryVo.class)
// public ApiResult<MerchantRolePermissionQueryVo> getMerchantRolePermission(@PathVariable("id") Long id) throws Exception {
// MerchantRolePermissionQueryVo merchantRolePermissionQueryVo = merchantRolePermissionService.getMerchantRolePermissionById(id);
// return ApiResult.ok(merchantRolePermissionQueryVo);
// }
//
// /**
// * 商家角色权限关系分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "商家角色权限关系分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "商家角色权限关系分页列表", response = MerchantRolePermissionQueryVo.class)
// public ApiResult<Paging<MerchantRolePermissionQueryVo>> getMerchantRolePermissionPageList(@Validated @RequestBody MerchantRolePermissionPageParam merchantRolePermissionPageParam) throws Exception {
// Paging<MerchantRolePermissionQueryVo> paging = merchantRolePermissionService.getMerchantRolePermissionPageList(merchantRolePermissionPageParam);
// return ApiResult.ok(paging);
// }
//
//}
//
//package com.jumeirah.api.merchant.controller;
//
//import com.jumeirah.common.service.impl.MerchantSmsService;
//import io.geekidea.springbootplus.framework.common.api.ApiResult;
//import io.geekidea.springbootplus.framework.common.controller.BaseController;
//import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
//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.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * APP用户 控制器
// *
// * @author wei
// * @since 2020-09-23
// */
//@Slf4j
//@RestController
////@Module("api-app")
//@Api(value = "短信验证码", tags = {"APP短信验证码相关"},hidden = true)
//@RequestMapping("/merchant/sms/")
//public class MerchantSmsController extends BaseController {
//
// @Autowired
// private MerchantSmsService merchantSmsService;
//
// /**
// * 获取注册验证码
// */
// @GetMapping("/registerCode")
// @OperationLog(name = "获取注册或登陆的验证码", type = OperationLogType.INFO)
// @ApiOperation(value = "获取注册或登陆的验证码", response = Object.class, notes = "本地环境默认666666")
// public ApiResult<Object> registerOrLoginCode(@RequestParam String phoneArea, @RequestParam String phone) throws Exception {
//
// return merchantSmsService.registerCode(phoneArea, phone);
// }
//
//}
//
package com.jumeirah.api.merchant.controller;
import com.jumeirah.common.entity.MerchantUser;
import com.jumeirah.common.param.MerchantLoginParam;
import com.jumeirah.common.param.MerchantUpdatePwdParam;
import com.jumeirah.common.param.MerchantUserInfoParam;
import com.jumeirah.common.service.MerchantService;
import com.jumeirah.common.service.MerchantUserService;
import com.jumeirah.common.vo.LoginMerUserTokenVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 商家用户 控制器
*
* @author wei
* @since 2020-09-27
*/
@Slf4j
@RestController
@RequestMapping("/merchant/user")
@Module("${cfg.module}")
@Api(value = "商家用户API", tags = {"商家用户表"})
public class MerchantUserController extends BaseController {
@Autowired
private MerchantUserService merchantUserService;
@Autowired
private MerchantService merchantService;
// /**
// * 添加商家用户
// */
// @PostMapping("/add")
// @OperationLog(name = "添加商家用户", type = OperationLogType.ADD)
// @ApiOperation(value = "添加商家用户", response = ApiResult.class)
// public ApiResult<Boolean> addMerchantUser(@Validated(Add.class) @RequestBody MerchantUser merchantUser) throws Exception {
// boolean flag = merchantUserService.saveMerchantUser(merchantUser);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改商家用户
// */
// @PostMapping("/update")
// @OperationLog(name = "修改商家用户", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改商家用户", response = ApiResult.class)
// public ApiResult<Boolean> updateMerchantUser(@Validated(Update.class) @RequestBody MerchantUser merchantUser) throws Exception {
// boolean flag = merchantUserService.updateMerchantUser(merchantUser);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除商家用户
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除商家用户", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除商家用户", response = ApiResult.class)
// public ApiResult<Boolean> deleteMerchantUser(@PathVariable("id") Long id) throws Exception {
// boolean flag = merchantUserService.deleteMerchantUser(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取商家用户详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "商家用户详情", type = OperationLogType.INFO)
// @ApiOperation(value = "商家用户详情", response = MerchantUserQueryVo.class)
// public ApiResult<MerchantUserQueryVo> getMerchantUser(@PathVariable("id") Long id) throws Exception {
// MerchantUserQueryVo merchantUserQueryVo = merchantUserService.getMerchantUserById(id);
// return ApiResult.ok(merchantUserQueryVo);
// }
//
// /**
// * 商家用户分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "商家用户分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "商家用户分页列表", response = MerchantUserQueryVo.class)
// public ApiResult<Paging<MerchantUserQueryVo>> getMerchantUserPageList(@Validated @RequestBody MerchantUserPageParam merchantUserPageParam) throws Exception {
// Paging<MerchantUserQueryVo> paging = merchantUserService.getMerchantUserPageList(merchantUserPageParam);
// return ApiResult.ok(paging);
// }
@PostMapping("/login")
@OperationLogIgnore
@ApiOperation(value = "登录", notes = "商家用户登录")
public ApiResult<LoginMerUserTokenVo> login(@Validated @RequestBody MerchantLoginParam merchantLoginParam, HttpServletResponse response) throws Exception {
return merchantUserService.login(merchantLoginParam);
}
@PostMapping("/updatePwd")
@OperationLogIgnore
@ApiOperation(value = "商家用户修改密码", notes = "商家用户修改密码, 修改完后需要跳到登陆界面,并重新登陆")
public ApiResult<Boolean> updatePwd(@Validated @RequestBody MerchantUpdatePwdParam merchantUpdatePwdParam) throws Exception {
return merchantUserService.updatePwd(merchantUpdatePwdParam);
}
@GetMapping("/info")
@OperationLogIgnore
@ApiOperation(value = "批量获取商户用户信息")
public ApiResult<List<MerchantUser>> merchantUserListByMcIdAndIds(@Validated @ModelAttribute MerchantUserInfoParam merchantUpdatePwdParam) {
return merchantUserService.getMerchantUserListByMcIdAndIds(merchantUpdatePwdParam);
}
// @PostMapping("/register")
// @OperationLogIgnore
// @ApiOperation(value = "注册", notes = "商家注册")
// public ApiResult<Boolean> register(@Validated @RequestBody MerchantRegisterParam merchantRegisterParam, HttpServletResponse response) throws Exception {
// return merchantUserService.register(merchantRegisterParam);
// }
}
package com.jumeirah.api.merchant.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.api.merchant.entity.param.MerchantUserAddParam;
import com.jumeirah.api.merchant.entity.param.MerchantUserUpdateParam;
import com.jumeirah.common.entity.MerchantUser;
import com.jumeirah.common.service.MerchantUserService;
import com.jumeirah.common.vo.MerchantUserQueryVo;
import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.Module;
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.geekidea.springbootplus.framework.shiro.util.SaltUtil;
import io.geekidea.springbootplus.framework.util.PasswordUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
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;
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;
import java.util.List;
/**
* 商家用户 控制器
*
* @author wei
* @since 2020-09-27
*/
@Slf4j
@RestController
@RequestMapping("/merchant/user/manager")
@Module("${cfg.module}")
@Api(value = "商家账户管理API", tags = {"商家账户管理"})
public class MerchantUserManagerController extends BaseController {
@Autowired
private MerchantUserService merchantUserService;
@Autowired
private SpringBootPlusProperties springBootPlusProperties;
/**
* 添加商家用户
*/
@PostMapping("/add")
@OperationLog(name = "添加商家用户", type = OperationLogType.ADD)
@ApiOperation(value = "添加商家用户", response = ApiResult.class)
public ApiResult<Boolean> addMerchantUser(@Validated(Add.class) @RequestBody MerchantUserAddParam merchantUserAddParam) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
// 查重
MerchantUser one = merchantUserService.getOne(new QueryWrapper<MerchantUser>().lambda().eq(MerchantUser::getUsername,merchantUserAddParam.getUsername()));
if (one !=null){
return ApiResult.fail();
}
MerchantUser merchantUser = new MerchantUser();
BeanUtils.copyProperties(merchantUserAddParam, merchantUser);
merchantUser.setMcId(jwtToken.getMcId());
// 生成盐值
String salt = null;
String password = merchantUserAddParam.getPassword();
// 如果密码为空,则设置默认密码
if (StringUtils.isBlank(password)) {
salt = springBootPlusProperties.getLoginInitSalt();
password = springBootPlusProperties.getLoginInitPassword();
} else {
salt = SaltUtil.generateSalt();
}
// 密码加密
merchantUser.setSalt(salt);
merchantUser.setPassword(PasswordUtil.encrypt(password, salt));
merchantUser.setIsAdmin(0);
boolean flag = merchantUserService.saveMerchantUser(merchantUser);
return ApiResult.result(flag);
}
/**
* 修改商家用户
*/
@PostMapping("/update")
@OperationLog(name = "修改商家用户", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家用户", response = ApiResult.class)
public ApiResult<Boolean> updateMerchantUser(@Validated(Update.class) @RequestBody MerchantUserUpdateParam merchantUserUpdateParam) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
MerchantUser sysUser = new MerchantUser().setUsername(merchantUserUpdateParam.getUsername());
MerchantUser one = merchantUserService.getOne(new QueryWrapper<MerchantUser>(sysUser));
MerchantUser merchantUser = new MerchantUser();
BeanUtils.copyProperties(merchantUserUpdateParam, merchantUser);
merchantUser.setMcId(jwtToken.getMcId());
merchantUser.setId(one.getId());
// 生成盐值
String salt = null;
String password = merchantUserUpdateParam.getPassword();
// 如果密码为空,则设置默认密码
if (StringUtils.isBlank(password)) {
salt = springBootPlusProperties.getLoginInitSalt();
password = springBootPlusProperties.getLoginInitPassword();
} else {
salt = SaltUtil.generateSalt();
}
// 密码加密
merchantUser.setSalt(salt);
merchantUser.setPassword(PasswordUtil.encrypt(password, salt));
boolean flag = merchantUserService.updateMerchantUser(merchantUser);
return ApiResult.result(flag);
}
/**
* 删除商家用户
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除商家用户", type = OperationLogType.DELETE)
@ApiOperation(value = "删除商家用户", response = ApiResult.class)
public ApiResult<Boolean> deleteMerchantUser(@PathVariable("id") Long id) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
boolean flag = merchantUserService.deleteMerchantUser(id);
return ApiResult.result(flag);
}
/**
* 获取商家用户详情
*/
@GetMapping("/info/{id}")
@OperationLog(name = "商家用户详情", type = OperationLogType.INFO)
@ApiOperation(value = "商家用户详情", response = MerchantUserQueryVo.class)
public ApiResult<MerchantUserQueryVo> getMerchantUser(@PathVariable("id") Long id) throws Exception {
MerchantUserQueryVo merchantUserQueryVo = merchantUserService.getMerchantUserById(id);
return ApiResult.ok(merchantUserQueryVo);
}
/**
* 商家用户分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "商家用户分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "商家用户分页列表")
public ApiResult<List<MerchantUserQueryVo>> getMerchantUserPageList() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
List<MerchantUserQueryVo> merchantUserListByMcId = merchantUserService.getMerchantUserListByMcId(jwtToken.getMcId());
return ApiResult.ok(merchantUserListByMcId);
}
}
package com.jumeirah.api.merchant.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.common.entity.MerchantUserPermission;
import com.jumeirah.common.param.MerchantUserPermissionDetailVo;
import com.jumeirah.common.param.MerchantUserPermissionUpdateParam;
import com.jumeirah.common.service.MerchantUserPermissionService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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;
import java.util.List;
/**
* 商家用户权限关系 控制器
*
* @author giao
* @since 2020-10-19
*/
@Slf4j
@RestController
@RequestMapping("/merchant/merchantUserPermission")
@Api(value = "商家用户权限关系API", tags = {"商家用户权限关系"})
public class MerchantUserPermissionController extends BaseController {
@Autowired
private MerchantUserPermissionService merchantUserPermissionService;
/**
* 查询商家用户权限详情
*/
@PostMapping("/update")
@OperationLog(name = "修改商家用户权限", type = OperationLogType.INFO)
@ApiOperation(value = "修改商家用户权限")
public ApiResult<Boolean> update(@RequestBody MerchantUserPermissionUpdateParam merchantUserPermissionUpdateParam) throws Exception {
// 删除该用户所有权限
merchantUserPermissionService.remove(new QueryWrapper<MerchantUserPermission>()
.lambda().eq(MerchantUserPermission::getUserId, merchantUserPermissionUpdateParam.getUserId()));
// 给管理管设置全部权限
for (Long id : merchantUserPermissionUpdateParam.getPermissionIds()) {
MerchantUserPermission merchantUserPermission = new MerchantUserPermission();
merchantUserPermission.setUserId(merchantUserPermissionUpdateParam.getUserId());
merchantUserPermission.setPermissionId(id);
merchantUserPermission.setState(0);
merchantUserPermissionService.save(merchantUserPermission);
}
return ApiResult.ok();
}
/**
* 查询某商家用户权限列表
*/
@GetMapping("/get/{userId}")
@OperationLog(name = "查询某商家用户权限列表", type = OperationLogType.INFO)
@ApiOperation(value = "查询某商家用户权限列表")
public ApiResult<List<MerchantUserPermissionDetailVo>> get(@PathVariable("userId") Long userId) throws Exception {
List<MerchantUserPermissionDetailVo> merchantUserPermissionByUserId = merchantUserPermissionService.getMerchantUserPermissionByUserId(userId);
return ApiResult.ok(merchantUserPermissionByUserId);
}
//
// /**
// *查询商家用户权限详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "商家用户权限关系详情", type = OperationLogType.INFO)
// @ApiOperation(value = "商家用户权限关系详情")
// public ApiResult<MerchantUserPermissionQueryVo> getMerchantUserPermission(@PathVariable("id") Long id) throws Exception {
// MerchantUserPermissionQueryVo merchantUserPermissionQueryVo = merchantUserPermissionService.getMerchantUserPermissionById(id);
// return ApiResult.ok(merchantUserPermissionQueryVo);
// }
// /**
// * 添加商家用户权限关系
// */
// @PostMapping("/add")
// @OperationLog(name = "添加商家用户权限关系", type = OperationLogType.ADD)
// @ApiOperation(value = "添加商家用户权限关系")
// public ApiResult<Boolean> addMerchantUserPermission(@Validated(Add.class) @RequestBody MerchantUserPermission merchantUserPermission) throws Exception {
// boolean flag = merchantUserPermissionService.saveMerchantUserPermission(merchantUserPermission);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改商家用户权限关系
// */
// @PostMapping("/update")
// @OperationLog(name = "修改商家用户权限关系", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改商家用户权限关系")
// public ApiResult<Boolean> updateMerchantUserPermission(@Validated(Update.class) @RequestBody MerchantUserPermission merchantUserPermission) throws Exception {
// boolean flag = merchantUserPermissionService.updateMerchantUserPermission(merchantUserPermission);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除商家用户权限关系
// */
// @PostMapping("/delete/{id}")
// @OperationLog(name = "删除商家用户权限关系", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除商家用户权限关系")
// public ApiResult<Boolean> deleteMerchantUserPermission(@PathVariable("id") Long id) throws Exception {
// boolean flag = merchantUserPermissionService.deleteMerchantUserPermission(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取商家用户权限关系详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "商家用户权限关系详情", type = OperationLogType.INFO)
// @ApiOperation(value = "商家用户权限关系详情")
// public ApiResult<MerchantUserPermissionQueryVo> getMerchantUserPermission(@PathVariable("id") Long id) throws Exception {
// MerchantUserPermissionQueryVo merchantUserPermissionQueryVo = merchantUserPermissionService.getMerchantUserPermissionById(id);
// return ApiResult.ok(merchantUserPermissionQueryVo);
// }
//
// /**
// * 商家用户权限关系分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "商家用户权限关系分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "商家用户权限关系分页列表")
// public ApiResult<Paging<MerchantUserPermissionQueryVo>> getMerchantUserPermissionPageList(@Validated @RequestBody MerchantUserPermissionPageParam merchantUserPermissionPageParam) throws Exception {
// Paging<MerchantUserPermissionQueryVo> paging = merchantUserPermissionService.getMerchantUserPermissionPageList(merchantUserPermissionPageParam);
// return ApiResult.ok(paging);
// }
}
package com.jumeirah.api.merchant.controller.management;
import com.jumeirah.common.param.McStrokePaymentPageParam;
import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.vo.McStrokePaymentQueryVo;
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.log.annotation.OperationLog;
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.validation.annotation.Validated;
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 wei
* @since 2020-09-29
*/
@Slf4j
@RestController
@RequestMapping("/merchant/payment")
@Api(value = "财务管理API", tags = {"财务管理"})
public class McStrokePaymentController extends BaseController {
@Autowired
private StrokeService strokeService;
/**
* 收款记录
*/
@PostMapping("/pageList")
@OperationLog(name = "收款记录", type = OperationLogType.PAGE)
@ApiOperation(value = "收款记录")
@RequiresPermissions("merchant:order:view")
public ApiResult<Paging<McStrokePaymentQueryVo>> getPaymentPageList(@Validated @RequestBody McStrokePaymentPageParam mcStrokePaymentPageParam) throws Exception {
Paging<McStrokePaymentQueryVo> paging = strokeService.getPaymentPageList(mcStrokePaymentPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.merchant.controller.order;
import com.jumeirah.common.entity.PlainType;
import com.jumeirah.common.service.PlainTypeService;
import com.jumeirah.common.vo.PlainTypeQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
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.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;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 飞机型号表 控制器
*
* @author wei
* @since 2020-10-09
*/
@Slf4j
@RestController
@RequestMapping("/merchant/plainType")
@Module("${cfg.module}")
@Api(value = "飞机型号表API", tags = {"飞机型号"})
public class McPlainTypeController extends BaseController {
@Autowired
private PlainTypeService plainTypeService;
/**
* 获取飞机型号列表
*/
@GetMapping("/getAllList")
@OperationLog(name = "获取飞机型号列表", type = OperationLogType.PAGE)
@ApiOperation(value = "获取飞机型号列表", response = PlainTypeQueryVo.class)
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<List<PlainType> > getAllList() throws Exception {
List<PlainType> plainTypeList = plainTypeService.getAllMap();
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.StrokeCancelParam;
import com.jumeirah.api.merchant.entity.param.StrokeConfirmPaymentParam;
import com.jumeirah.api.merchant.entity.param.StrokeDiscountCheckParam;
import com.jumeirah.common.entity.AppUser;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.enums.StatePaymentStatusEnum;
import com.jumeirah.common.enums.StrokeAuditStatusEnum;
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;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
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.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;
import java.sql.Timestamp;
/**
* 行程表 控制器
*
* @author wei
* @since 2020-09-29
*/
@Slf4j
@RestController
@RequestMapping("/merchant/stroke")
@Api(value = "行程API", tags = {"行程"})
public class McStrokeController extends BaseController {
@Autowired
private StrokeService strokeService;
@Autowired
private PushFactory pushFactory;
@Autowired
private AppUserService appUserService;
/**
* 完成行程接口
*/
@PostMapping("/complete")
@OperationLog(name = "完成行程接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "完成行程接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> completeStroke(@Validated @RequestBody StrokeCompleteParam strokeCompleteParam) throws Exception {
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);
}
/**
* 行程表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "行程分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程分页列表")
@RequiresPermissions("merchant:order:view")
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);
}
/**
* 行程报价接口
*/
@PostMapping("/update/quotedPrice")
@OperationLog(name = "行程报价接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "行程报价接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> updateStroke(@Validated @RequestBody StrokeQuotedPriceParam strokeQuotedPriceParam) throws Exception {
ApiResult<Boolean> result = strokeService.quotedPrice(strokeQuotedPriceParam);
if (result.getCode() == ApiCode.SUCCESS.getCode()) {
sendAppMsg(strokeQuotedPriceParam.getId(), "2", "您的订单已报价");
}
return result;
}
/**
* 优惠调机审核接口
*/
@PostMapping("/discount/check")
@OperationLog(name = "优惠调机审核接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "优惠调机审核接口", response = ApiResult.class)
@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());
//审核失败时,订单标记成已完成
if (StrokeAuditStatusEnum.AUDIT_FAILED.getCode() == strokeDiscountCheckParam.getAuditStatus().intValue()) {
stroke.setStatus(StrokeStatusEnum.COMPLETED.getCode());
}
boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag);
}
/**
* 行程订单确认付款接口
*/
@PostMapping("/confirmPayment")
@OperationLog(name = "行程订单确认付款接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "行程订单确认付款接口", response = ApiResult.class)
@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(StatePaymentStatusEnum.PAID.getCode());
boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag);
}
/**
* 取消(驳回)订单接口
*/
@PostMapping("/cancel")
@OperationLog(name = "取消(驳回)订单接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "取消(驳回)订单接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> cancel(@Validated @RequestBody StrokeCancelParam strokeCancelParam) throws Exception {
boolean flag = strokeService.cancel(strokeCancelParam.getId(),strokeCancelParam.getRefusalReason());
return ApiResult.result(flag);
}
/* *//**
* 修改行程表
*//*
@PostMapping("/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);
}
*//**
* 删除行程表
*//*
@PostMapping("/delete/{id}")
@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);
}
*//**
* 获取行程表详情
*//*
@GetMapping("/info/{id}")
@OperationLog(name = "行程表详情", type = OperationLogType.INFO)
@ApiOperation(value = "行程表详情", response = StrokeDetailVo.class)
public ApiResult<StrokeDetailVo> getStroke(@PathVariable("id") Long id) throws Exception {
StrokeDetailVo strokeQueryVo = strokeService.getStrokeById(id);
return ApiResult.ok(strokeQueryVo);
}*/
}
package com.jumeirah.api.merchant.controller.plain;
import com.jumeirah.api.merchant.entity.param.McBusinessPlainAddParam;
import com.jumeirah.common.entity.BusinessPlain;
import com.jumeirah.common.param.BusinessPlainPageParam;
import com.jumeirah.common.service.BusinessPlainService;
import com.jumeirah.common.vo.BusinessPlainQueryVo;
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.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.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 giao
* @since 2020-10-14
*/
@Slf4j
@RestController
@RequestMapping("/merchant/businessPlain")
@Api(value = "公务机出售托管表API", tags = {"公务机出售托管表"})
public class McBusinessPlainController extends BaseController {
@Autowired
private BusinessPlainService businessPlainService;
/**
* 添加公务机出售托管表
*/
@PostMapping("/add")
@OperationLog(name = "添加公务机出售托管表", type = OperationLogType.ADD)
@ApiOperation(value = "添加公务机出售托管表")
public ApiResult<Boolean> addBusinessPlain(@Validated(Add.class) @RequestBody McBusinessPlainAddParam mcBusinessPlainAddParam) throws Exception {
BusinessPlain businessPlain = new BusinessPlain();
BeanUtils.copyProperties(mcBusinessPlainAddParam, businessPlain);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
businessPlain.setMcId(jwtToken.getMcId());
boolean flag = businessPlainService.saveBusinessPlain(businessPlain);
return ApiResult.result(flag);
}
/**
* 修改公务机出售托管表
*/
@PostMapping("/update")
@OperationLog(name = "修改公务机出售托管表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改公务机出售托管表")
public ApiResult<Boolean> updateBusinessPlain(@Validated(Update.class) @RequestBody McBusinessPlainAddParam mcBusinessPlainAddParam) throws Exception {
BusinessPlain businessPlain = new BusinessPlain();
BeanUtils.copyProperties(mcBusinessPlainAddParam, businessPlain);
boolean flag = businessPlainService.updateBusinessPlain(businessPlain);
return ApiResult.result(flag);
}
/**
* 删除公务机出售托管表
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除公务机出售托管表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除公务机出售托管表")
public ApiResult<Boolean> deleteBusinessPlain(@PathVariable("id") Long id) throws Exception {
boolean flag = businessPlainService.deleteBusinessPlain(id);
return ApiResult.result(flag);
}
/**
* 公务机出售托管表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "公务机出售托管表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "公务机出售托管表分页列表")
public ApiResult<Paging<BusinessPlainQueryVo>> getBusinessPlainPageList(@Validated @RequestBody BusinessPlainPageParam businessPlainPageParam) throws Exception {
Paging<BusinessPlainQueryVo> paging = businessPlainService.getBusinessPlainPageList(businessPlainPageParam);
return ApiResult.ok(paging);
}
// /**
// * 获取公务机出售托管表详情
// */
// @GetMapping("/info/{id}")
// @OperationLog(name = "公务机出售托管表详情", type = OperationLogType.INFO)
// @ApiOperation(value = "公务机出售托管表详情")
// public ApiResult<BusinessPlainQueryVo> getBusinessPlain(@PathVariable("id") Long id) throws Exception {
// BusinessPlainQueryVo businessPlainQueryVo = businessPlainService.getBusinessPlainById(id);
// return ApiResult.ok(businessPlainQueryVo);
// }
}
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;
import com.jumeirah.common.enums.PlainTypeStatusEnum;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.service.McPlainService;
import com.jumeirah.common.service.PlainTypeService;
import com.jumeirah.common.vo.McPlainQueryVo;
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;
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.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-19
*/
@Slf4j
@RestController
@RequestMapping("/merchant/mcPlain")
@Api(value = "商家飞机表API", tags = {"商家飞机表"})
public class McPlainController extends BaseController {
@Autowired
private McPlainService mcPlainService;
@Autowired
private PlainTypeService plainTypeService;
/**
* 添加商家飞机表
*/
@PostMapping("/add")
@OperationLog(name = "添加商家飞机表", type = OperationLogType.ADD)
@ApiOperation(value = "添加商家飞机表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> addMcPlain(@Validated(Add.class) @RequestBody McPlainAddParam mcPlainAddParam) throws Exception {
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);
mcPlain.setMcId(jwtToken.getMcId())
.setIdleNum(mcPlainAddParam.getAmount());
boolean flag = mcPlainService.saveMcPlain(mcPlain);
return ApiResult.result(flag);
}
private boolean checkPtId(@RequestBody @Validated(Add.class) McPlainAddParam mcPlainAddParam) {
PlainType plainType = plainTypeService.getById(mcPlainAddParam.getPtId());
if (plainType == null || plainType.getStatus().intValue() == PlainTypeStatusEnum.CANCEL.getCode()) {
return true;
}
return false;
}
/**
* 修改商家飞机表
*/
@PostMapping("/update")
@OperationLog(name = "修改商家飞机表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家飞机表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> updateMcPlain(@Validated(Update.class) @RequestBody McPlainAddParam mcPlainAddParam) throws Exception {
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;
}
/**
* 删除商家飞机表
*/
@PostMapping("/delete/{id}")
@RequiresPermissions("merchant:aircraft:management:edit")
@OperationLog(name = "删除商家飞机表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除商家飞机表")
public ApiResult<Boolean> deleteMcPlain(@PathVariable("id") Long id) throws Exception {
boolean flag = mcPlainService.deleteMcPlain(id);
return ApiResult.result(flag);
}
/**
* 获取商家飞机表详情
*/
/* @GetMapping("/info/{id}")
@OperationLog(name = "商家飞机表详情", type = OperationLogType.INFO)
@ApiOperation(value = "商家飞机表详情")
public ApiResult<McPlainQueryVo> getMcPlain(@PathVariable("id") Long id) throws Exception {
McPlainQueryVo mcPlainQueryVo = mcPlainService.getMcPlainById(id);
return ApiResult.ok(mcPlainQueryVo);
}*/
/**
* 商家飞机表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "商家飞机表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "商家飞机表分页列表")
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<Paging<McPlainQueryVo>> getMcPlainPageList(@Validated @RequestBody McPlainPageParam mcPlainPageParam) throws Exception {
Paging<McPlainQueryVo> paging = mcPlainService.getMcPlainPageList(mcPlainPageParam);
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.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.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 McStrokeDiscountAddParam mcStrokeDiscountAddParam) throws Exception {
StrokeDiscount strokeDiscount = new StrokeDiscount();
BeanUtils.copyProperties(mcStrokeDiscountAddParam, strokeDiscount);
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.util.List;
/**
* 商家飞机表
*
* @author xxx
* @since 2020-10-19
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "McAppUser对象")
public class McAppUserParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "app用户ids不能为空")
@ApiModelProperty("app用户ids")
private List<Long> ids;
}
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;
}
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.NotBlank;
/**
* 商家
*
* @author wei
* @since 2020-09-28
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "MerchantUserAddParam对象")
public class MerchantUserAddParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotBlank(message = "账号不能为空")
@ApiModelProperty("账号")
private String username;
@NotBlank(message = "密码不能为空")
@ApiModelProperty("密码")
private String password;
@ApiModelProperty("职位")
private String position;
}
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.NotBlank;
/**
* 商家
*
* @author wei
* @since 2020-09-28
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "MerchantUserUpdateParam对象")
public class MerchantUserUpdateParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("用户名")
private String username;
@NotBlank(message = "密码不能为空")
@ApiModelProperty("密码")
private String password;
@ApiModelProperty("职位")
private String position;
}
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.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "StrokeCancelParam")
public class StrokeCancelParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空")
@ApiModelProperty("主键ID")
private Long id;
@NotBlank(message = "商家驳回理由不能为空")
@ApiModelProperty("商家驳回理由")
private String refusalReason;
}
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;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Stroke确认付款对象")
public class StrokeConfirmPaymentParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空")
@ApiModelProperty("主键ID")
private Long id;
@NotNull(message = "付款状态不能为空")
@ApiModelProperty("付款状态,0-未付款,1-付款中,2-已付款,3-退款中,99-已退款")
private Integer paymentStatus;
}
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;
/**
* 行程表
*
* @author wei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Stroke优惠调机审核对象")
public class StrokeDiscountCheckParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空")
@ApiModelProperty("主键ID")
private Long id;
@NotNull(message = "审核状态不能为空")
@ApiModelProperty("审核状态,0审核中,1审核通过,2审核未通过")
private Integer auditStatus;
}
package com.jumeirah.api.merchant.service;
import com.jumeirah.common.param.app.AppSmsRegisterParam;
import com.jumeirah.common.param.app.AppUserInfoParam;
import com.jumeirah.common.vo.app.LoginAppUserTokenVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
public interface MerchantUserApiService {
/**
* 注册
* @param loginParam
* @param language
* @return
* @throws Exception
*/
ApiResult<LoginAppUserTokenVo> register(AppSmsRegisterParam loginParam, String language) throws Exception;
// ApiResult<LoginAppUserTokenVo> login(AppSmsRegisterParam loginParam, String language) throws Exception;
/**
* 修改或补充用户信息
* @param appUserInfoParam
* @return
* @throws Exception
*/
boolean updateAppUser(AppUserInfoParam appUserInfoParam) throws Exception;
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
-->
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated-by="intellij"
xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">
<classpath>
<dir name="/Users/giaogiao/Documents/hewei/code/gitPull/spring-boot-plus-master/service/target/classes">
</dir>
</classpath>
</application>
/target/
/classes
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
.DS_Store
*.log
logs
*.rdb
# system 项目系统模块
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.geekidea.springbootplus</groupId>
<artifactId>parent</artifactId>
<version>2.0</version>
</parent>
<artifactId>api-system</artifactId>
<name>api-system</name>
<description>系统api服务模块</description>
<dependencies>
<dependency>
<groupId>io.geekidea.springbootplus</groupId>
<artifactId>framework</artifactId>
</dependency>
<dependency>
<groupId>io.geekidea.springbootplus</groupId>
<artifactId>common</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
///*
// * Copyright 2019-2029 geekidea(https://github.com/geekidea)
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
//package com.jumeirah.api.system.controller;
//
//import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties;
//import io.geekidea.springbootplus.framework.common.api.ApiResult;
//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.util.DownloadUtil;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import javax.servlet.http.HttpServletResponse;
//import java.util.List;
//
///**
// * 下载控制器
// *
// * @author geekidea
// * @date 2019/8/20
// * @since 1.2.1-RELEASE
// */
//@Slf4j
//@Controller
//@RequestMapping("/sys/download")
//@Module("system")
//@Api(value = "文件下载", tags = {"文件下载"})
//public class DownloadController {
//
// @Autowired
// private SpringBootPlusProperties springBootPlusProperties;
//
// /**
// * 下载文件
// */
// @GetMapping("/{downloadFileName}")
// @OperationLog(name = "下载文件", type = OperationLogType.download)
// @ApiOperation(value = "下载文件", notes = "下载文件", response = ApiResult.class)
// public void download(@PathVariable(required = true) String downloadFileName, HttpServletResponse response) throws Exception {
// // 下载目录,既是上传目录
// String downloadDir = springBootPlusProperties.getUploadPath();
// // 允许下载的文件后缀
// List<String> allowFileExtensions = springBootPlusProperties.getAllowDownloadFileExtensions();
// // 文件下载,使用默认下载处理器
// // 文件下载,使用自定义下载处理器
// DownloadUtil.download(downloadDir, downloadFileName, allowFileExtensions, response, (dir, fileName, file, fileExtension, contentType, length) -> {
// // 下载自定义处理,返回true:执行下载,false:取消下载
// log.info("dir = " + dir);
// log.info("fileName = " + fileName);
// log.info("file = " + file);
// log.info("fileExtension = " + fileExtension);
// log.info("contentType = " + contentType);
// log.info("length = " + length);
// return true;
// });
// }
//
//}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.api.system.controller;
import com.alibaba.fastjson.JSON;
import com.jumeirah.common.param.LoginParam;
import com.jumeirah.common.service.SysLoginService;
import com.jumeirah.common.service.SysUserService;
import com.jumeirah.common.vo.LoginSysUserTokenVo;
import com.jumeirah.common.vo.SysUserQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 登录控制器
*
* @author geekidea
* @date 2019-09-28
* @since 1.3.0.RELEASE
**/
@Slf4j
@RestController
@Module("system")
@Api(value = "系统登录API", tags = {"系统登录"})
@RequestMapping("/sys/")
public class LoginController {
@Autowired
private SysLoginService loginService;
@Autowired
private SysUserService sysUserService;
@Autowired
private RedisTemplate redisTemplate;
@PostMapping("/login")
@OperationLogIgnore
@ApiOperation(value = "登录", notes = "系统用户登录", response = LoginSysUserTokenVo.class)
public ApiResult<LoginSysUserTokenVo> login(@Validated @RequestBody LoginParam loginParam, HttpServletResponse response, @RequestHeader(required = false) String language) throws Exception {
return loginService.login(loginParam, response, language);
}
/**
* 根据token获取系统登录用户信息
*
* @return
*/
@GetMapping("/getSysUserInfo")
@ApiOperation(value = "根据token获取系统登录用户信息", response = SysUserQueryVo.class)
public ApiResult<JSON> getSysUser() throws Exception {
// String token = JwtTokenUtil.getToken();
// String tokenSha256 = DigestUtils.sha256Hex(token);
// LoginSysUserVo loginSysUserVo = (LoginSysUserVo) redisTemplate.opsForValue().get(tokenSha256);
// return ApiResult.ok(loginSysUserVo);
String json = "{\n" +
" roles: ['admin'],\n" +
" introduction: 'I am a super administrator',\n" +
" avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',\n" +
" name: 'Super Admin'\n" +
" }";
JSON array = JSON.parseObject(json);
return ApiResult.ok(array);
}
@PostMapping("/logout")
@OperationLogIgnore
public ApiResult<String> logout(HttpServletRequest request) throws Exception {
loginService.logout(request);
return ApiResult.ok("退出成功");
}
}
package com.jumeirah.api.system.controller;
import com.jumeirah.common.entity.Merchant;
import com.jumeirah.common.param.MerchantPageParam;
import com.jumeirah.common.service.MerchantService;
import com.jumeirah.common.vo.MerchantQueryVo;
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.core.validator.groups.Update;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 航空公司商家表 控制器
*
* @author giao
* @since 2020-10-13
*/
@Slf4j
@RestController
@RequestMapping("/sys/merchant")
@Api(value = "航空公司商家表API", tags = {"航空公司商家表"})
public class MerchantForSysController extends BaseController {
@Autowired
private MerchantService merchantService;
/**
* 添加航空公司商家表
*/
@PostMapping("/add")
@OperationLog(name = "添加航空公司商家表", type = OperationLogType.ADD)
@ApiOperation(value = "添加航空公司商家表")
public ApiResult<Boolean> addMerchant(@Validated(Add.class) @RequestBody Merchant merchant) throws Exception {
boolean flag = merchantService.saveMerchant(merchant);
return ApiResult.result(flag);
}
/**
* 修改航空公司商家表
*/
@PostMapping("/update")
@OperationLog(name = "修改航空公司商家表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改航空公司商家表")
public ApiResult<Boolean> updateMerchant(@Validated(Update.class) @RequestBody Merchant merchant) throws Exception {
boolean flag = merchantService.updateMerchant(merchant);
return ApiResult.result(flag);
}
/**
* 删除航空公司商家表
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除航空公司商家表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除航空公司商家表")
public ApiResult<Boolean> deleteMerchant(@PathVariable("id") Long id) throws Exception {
boolean flag = merchantService.deleteMerchant(id);
return ApiResult.result(flag);
}
/**
* 获取航空公司商家表详情
*/
@GetMapping("/info/{id}")
@OperationLog(name = "航空公司商家表详情", type = OperationLogType.INFO)
@ApiOperation(value = "航空公司商家表详情")
public ApiResult<MerchantQueryVo> getMerchant(@PathVariable("id") Long id) throws Exception {
MerchantQueryVo merchantQueryVo = merchantService.getMerchantById(id);
return ApiResult.ok(merchantQueryVo);
}
/**
* 航空公司商家表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "航空公司商家表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "航空公司商家表分页列表")
public ApiResult<Paging<MerchantQueryVo>> getMerchantPageList(@Validated @RequestBody MerchantPageParam merchantPageParam) throws Exception {
Paging<MerchantQueryVo> paging = merchantService.getMerchantPageList(merchantPageParam);
return ApiResult.ok(paging);
}
}
///*
// * Copyright 2019-2029 geekidea(https://github.com/geekidea)
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
//package com.jumeirah.api.system.controller;
//
//import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties;
//import io.geekidea.springbootplus.framework.common.api.ApiResult;
//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.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import javax.servlet.http.HttpServletResponse;
//
///**
// * 图片等文件资源访问控制器
// * /api/resource 访问路径 用于区分 文件访问虚拟目录映射 /resource
// *
// * @author geekidea
// * @date 2019/8/20
// * @since 1.2.1-RELEASE
// */
//@Slf4j
//@Controller
//@RequestMapping("/api/resource")
//@Module("system")
//@Api(value = "资源访问", tags = {"资源访问"})
//public class ResourceController {
//
// @Autowired
// private SpringBootPlusProperties springBootPlusProperties;
//
// /**
// * 访问资源
// */
// @GetMapping("/image/{imageFileName}")
// @OperationLog(name = "访问资源", type = OperationLogType.ADD)
// @ApiOperation(value = "访问资源", response = ApiResult.class)
// public void getImage(@PathVariable(required = true) String imageFileName, HttpServletResponse response) throws Exception {
// log.info("imageFileName:{}", imageFileName);
// // 重定向到图片访问路径
// response.sendRedirect(springBootPlusProperties.getResourceAccessPath() + imageFileName);
// }
//
//}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.api.system.controller;
import com.jumeirah.common.entity.SysDepartment;
import com.jumeirah.common.param.SysDepartmentPageParam;
import com.jumeirah.common.service.SysDepartmentService;
import com.jumeirah.common.vo.SysDepartmentQueryVo;
import com.jumeirah.common.vo.SysDepartmentTreeVo;
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.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;
import java.util.List;
/**
* <pre>
* 部门 前端控制器
* </pre>
*
* @author geekidea
* @since 2019-10-24
*/
@Slf4j
@RestController
@RequestMapping("/sys/sysDepartment")
@Module("system")
@Api(value = "系统部门API", tags = {"系统部门"})
public class SysDepartmentController extends BaseController {
@Autowired
private SysDepartmentService sysDepartmentService;
/**
* 添加部门
*/
@PostMapping("/add")
@RequiresPermissions("sys:department:add")
@OperationLog(name = "添加部门", type = OperationLogType.ADD)
@ApiOperation(value = "添加部门", response = ApiResult.class)
public ApiResult<Boolean> addSysDepartment(@Validated @RequestBody SysDepartment sysDepartment) throws Exception {
boolean flag = sysDepartmentService.saveSysDepartment(sysDepartment);
return ApiResult.result(flag);
}
/**
* 修改部门
*/
@PostMapping("/update")
@RequiresPermissions("sys:department:update")
@OperationLog(name = "修改部门", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改部门", response = ApiResult.class)
public ApiResult<Boolean> updateSysDepartment(@Validated @RequestBody SysDepartment sysDepartment) throws Exception {
boolean flag = sysDepartmentService.updateSysDepartment(sysDepartment);
return ApiResult.result(flag);
}
/**
* 删除部门
*/
@PostMapping("/delete/{id}")
@RequiresPermissions("sys:department:delete")
@OperationLog(name = "删除部门", type = OperationLogType.DELETE)
@ApiOperation(value = "删除部门", response = ApiResult.class)
public ApiResult<Boolean> deleteSysDepartment(@PathVariable("id") Long id) throws Exception {
boolean flag = sysDepartmentService.deleteSysDepartment(id);
return ApiResult.result(flag);
}
/**
* 获取部门
*/
@GetMapping("/info/{id}")
@RequiresPermissions("sys:department:info")
@OperationLog(name = "部门详情", type = OperationLogType.INFO)
@ApiOperation(value = "部门详情", response = SysDepartmentQueryVo.class)
public ApiResult<SysDepartmentQueryVo> getSysDepartment(@PathVariable("id") Long id) throws Exception {
SysDepartmentQueryVo sysDepartmentQueryVo = sysDepartmentService.getSysDepartmentById(id);
return ApiResult.ok(sysDepartmentQueryVo);
}
/**
* 部门分页列表
*/
@PostMapping("/getPageList")
@RequiresPermissions("sys:department:page")
@OperationLog(name = "部门分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "部门分页列表", response = SysDepartmentQueryVo.class)
public ApiResult<Paging<SysDepartmentQueryVo>> getSysDepartmentPageList(@Validated @RequestBody SysDepartmentPageParam sysDepartmentPageParam) throws Exception {
Paging<SysDepartmentQueryVo> paging = sysDepartmentService.getSysDepartmentPageList(sysDepartmentPageParam);
return ApiResult.ok(paging);
}
/**
* 获取所有部门列表
*/
@PostMapping("/getAllDepartmentList")
@RequiresPermissions("sys:department:all:list")
@OperationLog(name = "获取所有部门的树形列表", type = OperationLogType.OTHER_QUERY)
@ApiOperation(value = "获取所有部门的树形列表", response = SysDepartment.class)
public ApiResult<List<SysDepartment>> getAllDepartmentList() throws Exception {
List<SysDepartment> list = sysDepartmentService.getAllDepartmentList();
return ApiResult.ok(list);
}
/**
* 获取所有部门的树形列表
*
* @return
*/
@PostMapping("/getDepartmentTree")
@RequiresPermissions("sys:department:all:tree")
@OperationLog(name = "获取所有部门的树形列表", type = OperationLogType.OTHER_QUERY)
@ApiOperation(value = "获取所有部门的树形列表", response = SysDepartmentTreeVo.class)
public ApiResult<List<SysDepartmentTreeVo>> getDepartmentTree() throws Exception {
List<SysDepartmentTreeVo> treeVos = sysDepartmentService.getDepartmentTree();
return ApiResult.ok(treeVos);
}
/**
* 部门列表
*/
@PostMapping("/getList")
@RequiresPermissions("sys:department:list")
@OperationLog(name = "部门列表", type = OperationLogType.LIST)
@ApiOperation(value = "部门列表", response = SysDepartment.class)
public ApiResult<List<SysDepartment>> getSysDepartmentList() throws Exception {
List<SysDepartment> list = sysDepartmentService.list();
return ApiResult.ok(list);
}
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.api.system.controller;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
/**
* Hello World Controller
*
* @author geekidea
* @date 2019-10-09
**/
@Slf4j
@Api(value = "Hello World", tags = {"Hello World"})
@RestController
@RequestMapping("/sys/hello")
public class SysHelloWorldController {
/**
* Hello World
*
* @return
* @throws IOException
*/
@GetMapping(value = "/world")
@OperationLog(name = "helloWorld")
@ApiOperation(value = "Hello World", response = String.class)
public ApiResult<String> helloWorld() throws IOException {
log.debug("Hello World.../system");
return ApiResult.ok("Hello World/system");
}
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.api.system.controller;
import com.jumeirah.common.entity.SysPermission;
import com.jumeirah.common.param.SysPermissionPageParam;
import com.jumeirah.common.service.SysPermissionService;
import com.jumeirah.common.service.SysRolePermissionService;
import com.jumeirah.common.vo.SysPermissionQueryVo;
import com.jumeirah.common.vo.SysPermissionTreeVo;
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.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;
import java.util.List;
/**
* <pre>
* 系统权限 前端控制器
* </pre>
*
* @author geekidea
* @since 2019-10-24
*/
@Slf4j
@RestController
@RequestMapping("/sys/sysPermission")
@Module("system")
@Api(value = "系统权限 API", tags = {"系统权限"})
public class SysPermissionController extends BaseController {
@Autowired
private SysPermissionService sysPermissionService;
@Autowired
private SysRolePermissionService sysRolePermissionService;
/**
* 添加系统权限
*/
@PostMapping("/add")
@RequiresPermissions("sys:permission:add")
@OperationLog(name = "添加系统权限", type = OperationLogType.ADD)
@ApiOperation(value = "添加系统权限", response = ApiResult.class)
public ApiResult<Boolean> addSysPermission(@Validated @RequestBody SysPermission sysPermission) throws Exception {
boolean flag = sysPermissionService.saveSysPermission(sysPermission);
return ApiResult.result(flag);
}
/**
* 修改系统权限
*/
@PostMapping("/update")
@RequiresPermissions("sys:permission:update")
@OperationLog(name = "添加系统权限", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改系统权限", response = ApiResult.class)
public ApiResult<Boolean> updateSysPermission(@Validated @RequestBody SysPermission sysPermission) throws Exception {
boolean flag = sysPermissionService.updateSysPermission(sysPermission);
return ApiResult.result(flag);
}
/**
* 删除系统权限
*/
@PostMapping("/delete/{id}")
@RequiresPermissions("sys:permission:delete")
@OperationLog(name = "删除系统权限", type = OperationLogType.DELETE)
@ApiOperation(value = "删除系统权限", response = ApiResult.class)
public ApiResult<Boolean> deleteSysPermission(@PathVariable("id") Long id) throws Exception {
boolean flag = sysPermissionService.deleteSysPermission(id);
return ApiResult.result(flag);
}
/**
* 系统权限详情
*/
@GetMapping("/info/{id}")
@RequiresPermissions("sys:permission:info")
@OperationLog(name = "系统权限详情", type = OperationLogType.INFO)
@ApiOperation(value = "系统权限详情", notes = "", response = SysPermissionQueryVo.class)
public ApiResult<SysPermissionQueryVo> getSysPermission(@PathVariable("id") Long id) throws Exception {
SysPermissionQueryVo sysPermissionQueryVo = sysPermissionService.getSysPermissionById(id);
return ApiResult.ok(sysPermissionQueryVo);
}
/**
* 系统权限分页列表
*/
@PostMapping("/getPageList")
@RequiresPermissions("sys:permission:page")
@OperationLog(name = "系统权限分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "系统权限分页列表", response = SysPermissionQueryVo.class)
public ApiResult<Paging<SysPermissionQueryVo>> getSysPermissionPageList(@Validated @RequestBody SysPermissionPageParam sysPermissionPageParam) throws Exception {
Paging<SysPermissionQueryVo> paging = sysPermissionService.getSysPermissionPageList(sysPermissionPageParam);
return ApiResult.ok(paging);
}
/**
* 获取所有菜单列表
*
* @return
*/
@PostMapping("/getAllMenuList")
@RequiresPermissions("sys:permission:all:menu:list")
@OperationLog(name = "获取所有菜单列表", type = OperationLogType.LIST)
@ApiOperation(value = "获取所有菜单列表", response = SysPermission.class)
public ApiResult<List<SysPermission>> getAllMenuList() throws Exception {
List<SysPermission> list = sysPermissionService.getAllMenuList();
return ApiResult.ok(list);
}
/**
* 获取获取菜单树形列表
*
* @return
*/
@PostMapping("/getAllMenuTree")
@RequiresPermissions("sys:permission:all:menu:tree")
@OperationLog(name = "获取获取菜单树形列表", type = OperationLogType.OTHER_QUERY)
@ApiOperation(value = "获取获取菜单树形列表", response = SysPermissionTreeVo.class)
public ApiResult<List<SysPermissionTreeVo>> getAllMenuTree() throws Exception {
List<SysPermissionTreeVo> treeVos = sysPermissionService.getAllMenuTree();
return ApiResult.ok(treeVos);
}
/**
* 根据用户id获取菜单列表
*
* @return
*/
@PostMapping("/getMenuListByUserId/{userId}")
@RequiresPermissions("sys:permission:menu:list")
@OperationLog(name = "根据用户id获取菜单列表", type = OperationLogType.OTHER_QUERY)
@ApiOperation(value = "根据用户id获取菜单列表", response = SysPermission.class)
public ApiResult<List<SysPermission>> getMenuListByUserId(@PathVariable("userId") Long userId) throws Exception {
List<SysPermission> list = sysPermissionService.getMenuListByUserId(userId);
return ApiResult.ok(list);
}
/**
* 根据用户id获取菜单树形列表
*
* @return
*/
@PostMapping("/getMenuTreeByUserId/{userId}")
@RequiresPermissions("sys:permission:menu:tree")
@OperationLog(name = "根据用户id获取菜单树形列表", type = OperationLogType.OTHER_QUERY)
@ApiOperation(value = "根据用户id获取菜单树形列表", response = SysPermissionTreeVo.class)
public ApiResult<List<SysPermissionTreeVo>> getMenuTreeByUserId(@PathVariable("userId") Long userId) throws Exception {
List<SysPermissionTreeVo> treeVos = sysPermissionService.getMenuTreeByUserId(userId);
return ApiResult.ok(treeVos);
}
/**
* 根据用户id获取该用户所有权限编码
*
* @return
*/
@GetMapping("/getPermissionCodesByUserId/{userId}")
@RequiresPermissions("sys:permission:codes")
@OperationLog(name = "根据用户id获取该用户所有权限编码", type = OperationLogType.OTHER_QUERY)
@ApiOperation(value = "根据用户id获取该用户所有权限编码", response = ApiResult.class)
public ApiResult<List<String>> getPermissionCodesByUserId(@PathVariable("userId") Long userId) throws Exception {
List<String> list = sysPermissionService.getPermissionCodesByUserId(userId);
return ApiResult.ok(list);
}
/**
* 根据角色id获取该对应的所有三级权限ID
*
* @return
*/
@GetMapping("/getThreeLevelPermissionIdsByRoleId/{roleId}")
@RequiresPermissions("sys:permission:three-ids-by-role-id")
@OperationLog(name = "根据角色id获取该对应的所有三级权限ID", type = OperationLogType.OTHER_QUERY)
@ApiOperation(value = "根据角色id获取该对应的所有三级权限ID", response = ApiResult.class)
public ApiResult<List<Long>> getPermissionIdsByRoleId(@PathVariable("roleId") Long roleId) throws Exception {
List<Long> list = sysRolePermissionService.getThreeLevelPermissionIdsByRoleId(roleId);
return ApiResult.ok(list);
}
/**
* 获取所有导航树形菜单(一级/二级菜单)
*
* @return
*/
@PostMapping("/getNavMenuTree")
@RequiresPermissions("sys:permission:nav-menu")
@OperationLog(name = "获取所有导航菜单(一级/二级菜单)", type = OperationLogType.OTHER_QUERY)
@ApiOperation(value = "获取所有导航菜单(一级/二级菜单)", response = ApiResult.class)
public ApiResult<List<SysPermissionTreeVo>> getNavMenuTree() throws Exception {
List<SysPermissionTreeVo> list = sysPermissionService.getNavMenuTree();
return ApiResult.ok(list);
}
}
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.api.system.controller;
import com.jumeirah.common.entity.SysRole;
import com.jumeirah.common.param.sysrole.SysRolePageParam;
import com.jumeirah.common.param.sysrole.UpdateSysRolePermissionParam;
import com.jumeirah.common.service.SysRoleService;
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.core.validator.groups.Update;
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.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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;
import java.util.List;
/**
* <pre>
* 系统角色 前端控制器
* </pre>
*
* @author geekidea
* @since 2019-10-24
*/
@Slf4j
@RestController
@RequestMapping("/sys/sysRole")
@Module("system")
@Api(value = "系统角色API", tags = {"系统角色"})
public class SysRoleController extends BaseController {
@Autowired
private SysRoleService sysRoleService;
/**
* 添加系统角色
*/
@PostMapping("/add")
@RequiresPermissions("sys:role:add")
@OperationLog(name = "添加系统角色", type = OperationLogType.ADD)
@ApiOperation(value = "添加系统角色", response = ApiResult.class)
public ApiResult<Boolean> addSysRole(@Validated(Add.class) @RequestBody SysRole sysRole) throws Exception {
boolean flag = sysRoleService.saveSysRole(sysRole);
return ApiResult.result(flag);
}
/**
* 修改系统角色
*/
@PostMapping("/update")
@RequiresPermissions("sys:role:update")
@OperationLog(name = "修改系统角色", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改系统角色", response = ApiResult.class)
public ApiResult<Boolean> updateSysRole(@Validated(Update.class) @RequestBody SysRole sysRole) throws Exception {
boolean flag = sysRoleService.updateSysRole(sysRole);
return ApiResult.result(flag);
}
/**
* 删除系统角色
*/
@PostMapping("/delete/{id}")
@RequiresPermissions("sys:role:delete")
@OperationLog(name = "删除系统角色", type = OperationLogType.DELETE)
@ApiOperation(value = "删除系统角色", response = ApiResult.class)
public ApiResult<Boolean> deleteSysRole(@PathVariable("id") Long id) throws Exception {
boolean flag = sysRoleService.deleteSysRole(id);
return ApiResult.result(flag);
}
/**
* 获取系统角色
*/
@GetMapping("/info/{id}")
@RequiresPermissions("sys:role:info")
@OperationLog(name = "系统角色详情", type = OperationLogType.INFO)
@ApiOperation(value = "系统角色详情", response = SysRole.class)
public ApiResult<SysRole> getSysRole(@PathVariable("id") Long id) throws Exception {
SysRole sysRole = sysRoleService.getById(id);
return ApiResult.ok(sysRole);
}
/**
* 系统角色分页列表
*/
@PostMapping("/getPageList")
@RequiresPermissions("sys:role:page")
@OperationLog(name = "系统角色分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "系统角色分页列表", response = SysRole.class)
public ApiResult<Paging<SysRole>> getSysRolePageList(@Validated @RequestBody SysRolePageParam sysRolePageParam) throws Exception {
Paging<SysRole> paging = sysRoleService.getSysRolePageList(sysRolePageParam);
return ApiResult.ok(paging);
}
/**
* 获取系统角色列表
*
* @return
*/
@PostMapping("/getList")
@RequiresPermissions("sys:role:list")
@OperationLog(name = "系统角色列表", type = OperationLogType.LIST)
@ApiOperation(value = "系统角色列表", response = SysRole.class)
public ApiResult<List<SysRole>> getRoleList() {
return ApiResult.ok(sysRoleService.list());
}
/**
* 修改系统角色权限
*/
@PostMapping("/updateSysRolePermission")
@RequiresPermissions("sys:role-permission:update")
@OperationLog(name = "修改系统角色权限", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改系统角色权限", response = ApiResult.class)
public ApiResult<Boolean> updateSysRolePermission(@Validated @RequestBody UpdateSysRolePermissionParam param) throws Exception {
boolean flag = sysRoleService.updateSysRolePermission(param);
return ApiResult.result(flag);
}
}
package com.jumeirah.api.system.controller;
import com.jumeirah.api.system.service.SysSmsService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* APP用户 控制器
*
* @author wei
* @since 2020-09-23
*/
@Slf4j
@RestController
@Api(value = "短信验证码", tags = {"短信验证码相关"})
@RequestMapping("/sys/sms/")
public class SysSmsController extends BaseController {
@Autowired
private SysSmsService appSmsService;
/**
* 获取注册验证码
*/
@GetMapping("/registerCode")
@OperationLog(name = "获取注册验证码", type = OperationLogType.INFO)
@ApiOperation(value = "获取注册验证码", response = Object.class, notes = "本地环境默认666666")
public ApiResult<Object> registerOrLoginCode(@RequestParam String phoneArea, @RequestParam String phone) throws Exception {
return appSmsService.registerOrLoginCode(phoneArea, phone);
}
}
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