Commit c3c98f84 by giaogiao

1.完成行程列表分页查询,删除

2.修改语言国际化
parent 8dfe8ea4
......@@ -13,10 +13,11 @@ import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
/**
*
* Hello World Controller
**/
@Slf4j
@Api(value = "Hello World2", tags = {"APP Hello World2"})
@Api(value = "权限测试", tags = {"APP Hello World2"})
@RestController
@RequestMapping("/app")
//@Module("api-app")
......
package com.jumeirah.api.app.controller;
import com.jumeirah.api.app.service.AppUserApiService;
import com.jumeirah.common.entity.AppUser;
import com.jumeirah.common.param.AppUserPageParam;
import com.jumeirah.common.param.app.AppSmsRegisterParam;
import com.jumeirah.common.param.app.AppUserInfoParam;
import com.jumeirah.common.service.AppUserService;
import com.jumeirah.common.vo.AppUserQueryVo;
import com.jumeirah.common.vo.app.LoginAppUserTokenVo;
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.RequiresRoles;
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.RequestHeader;
......@@ -60,9 +51,9 @@ public class AppUserController extends BaseController {
return ApiResult.result(flag);
}
/**
/* *//**
* 添加APP用户
*/
*//*
@PostMapping("/add")
@OperationLog(name = "添加APP用户", type = OperationLogType.ADD)
@ApiOperation(value = "添加APP用户", response = ApiResult.class)
......@@ -72,9 +63,9 @@ public class AppUserController extends BaseController {
return ApiResult.result(flag);
}
/**
*//**
* 修改APP用户
*/
*//*
@PostMapping("/update")
@OperationLog(name = "修改APP用户", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改APP用户", response = ApiResult.class)
......@@ -84,9 +75,9 @@ public class AppUserController extends BaseController {
return ApiResult.result(flag);
}
/**
*//**
* 删除APP用户
*/
*//*
@PostMapping("/delete/{id}")
@OperationLog(name = "删除APP用户", type = OperationLogType.DELETE)
@ApiOperation(value = "删除APP用户", response = ApiResult.class)
......@@ -96,9 +87,9 @@ public class AppUserController extends BaseController {
return ApiResult.result(flag);
}
/**
*//**
* 获取APP用户详情
*/
*//*
@GetMapping("/info/{id}")
@OperationLog(name = "APP用户详情", type = OperationLogType.INFO)
@ApiOperation(value = "APP用户详情", response = AppUserQueryVo.class)
......@@ -108,9 +99,11 @@ public class AppUserController extends BaseController {
return ApiResult.ok(appUserQueryVo);
}
*/
/**
* APP用户分页列表
*/
*//*
@PostMapping("/getPageList")
@OperationLog(name = "APP用户分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "APP用户分页列表", response = AppUserQueryVo.class)
......@@ -118,8 +111,7 @@ public class AppUserController extends BaseController {
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 {
......
package com.jumeirah.api.app.controller;
import cn.hutool.core.date.DateUtil;
import com.jumeirah.api.app.entity.vo.StrokeAddBackAndForthVo;
import com.jumeirah.api.app.entity.vo.StrokeAddFreightVo;
import com.jumeirah.api.app.entity.vo.StrokeAddMedicalTreatmentVo;
import com.jumeirah.api.app.entity.vo.StrokeAddOneWayVo;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.service.StrokeService;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import lombok.extern.slf4j.Slf4j;
import com.jumeirah.common.param.StrokePageParam;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo;
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.common.param.IdParam;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import io.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.web.bind.annotation.*;
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;
/**
* 行程表 控制器
......@@ -37,7 +38,6 @@ import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/stroke")
@Module("${cfg.module}")
@Api(value = "行程表API", tags = {"行程表"})
public class StrokeController extends BaseController {
......@@ -110,16 +110,16 @@ public class StrokeController extends BaseController {
}
/**
* 修改行程表
*/
@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("/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);
// }
/**
* 删除行程表
......@@ -137,19 +137,30 @@ public class StrokeController extends BaseController {
*/
@GetMapping("/info/{id}")
@OperationLog(name = "行程表详情", type = OperationLogType.INFO)
@ApiOperation(value = "行程表详情", response = StrokeQueryVo.class)
public ApiResult<StrokeQueryVo> getStroke(@PathVariable("id") Long id) throws Exception {
StrokeQueryVo strokeQueryVo = strokeService.getStrokeById(id);
@ApiOperation(value = "行程表详情", response = StrokeDetailVo.class)
public ApiResult<StrokeDetailVo> getStroke(@PathVariable("id") Long id) throws Exception {
StrokeDetailVo strokeQueryVo = strokeService.getStrokeById(id);
return ApiResult.ok(strokeQueryVo);
}
// /**
// * 行程表分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "行程表分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "行程表分页列表", response = StrokeQueryVo.class)
// public ApiResult<Paging<StrokeQueryVo>> getStrokePageList(@Validated @RequestBody StrokePageParam strokePageParam) throws Exception {
// Paging<StrokeQueryVo> paging = strokeService.getStrokePageList(strokePageParam);
// return ApiResult.ok(paging);
// }
/**
* 行程表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "行程分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程分页列表", response = StrokeQueryVo.class)
public ApiResult<Paging<StrokeQueryVo>> getStrokePageList(@Validated @RequestBody StrokePageParam strokePageParam) throws Exception {
@PostMapping("/getMyStrokePageList")
@OperationLog(name = "行程分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程分页列表", response = StrokeQueryVo.class)
public ApiResult<Paging<StrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody StrokePageParam strokePageParam) throws Exception {
Paging<StrokeQueryVo> paging = strokeService.getStrokePageList(strokePageParam);
return ApiResult.ok(paging);
}
......
......@@ -15,7 +15,7 @@ public interface AppUserApiService {
* @throws Exception
*/
ApiResult<LoginAppUserTokenVo> register(AppSmsRegisterParam loginParam, String language) throws Exception;
ApiResult<LoginAppUserTokenVo> login(AppSmsRegisterParam loginParam, String language) throws Exception;
// ApiResult<LoginAppUserTokenVo> login(AppSmsRegisterParam loginParam, String language) throws Exception;
/**
* 修改或补充用户信息
......
......@@ -29,7 +29,7 @@ public class AppUserApiServiceImpl implements AppUserApiService {
// 校验验证码
boolean equalsRegisterCode = appSmsService.equalsRegisterCode(loginParam.getPhoneArea(), loginParam.getPhone(), loginParam.getSmsCode());
if (!equalsRegisterCode) {
return ApiResult.fail(ApiCode.FAIL, new LoginAppUserTokenVo());
return ApiResult.fail(ApiCode.SMS_CODE_ERROR, new LoginAppUserTokenVo());
}
// 删除已使用的验证码
appSmsService.deleteRegisterCode(loginParam.getPhoneArea(), loginParam.getPhone());
......@@ -45,17 +45,17 @@ public class AppUserApiServiceImpl implements AppUserApiService {
appUser.setPhone(loginParam.getPhone());
boolean isDbOk = appUserService.saveAppUser(appUser);
if (!isDbOk) {
return ApiResult.fail(ApiCode.FAIL, new LoginAppUserTokenVo());
return ApiResult.fail(ApiCode.SPRING_BOOT_PLUS_EXCEPTION, new LoginAppUserTokenVo());
}
// 走登陆的代码
return appUserService.login(loginParam, language, false);
}
@Override
public ApiResult<LoginAppUserTokenVo> login(AppSmsRegisterParam loginParam, String language) throws Exception {
return null;
}
// @Override
// public ApiResult<LoginAppUserTokenVo> login(AppSmsRegisterParam loginParam, String language) throws Exception {
// return null;
// }
@Override
public boolean updateAppUser(AppUserInfoParam appUserInfoParam) throws Exception {
......
package com.jumeirah.common.entity;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
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;
......@@ -16,8 +14,6 @@ import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
/**
* 行程表
*
......@@ -40,6 +36,10 @@ public class Stroke extends BaseEntity {
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@ApiModelProperty("逻辑删除,0:未删除,1:已删除")
@TableLogic
private Integer deleted;
@NotBlank(message = "出发城市名称不能为空")
@ApiModelProperty("出发城市名称")
private String cityOutsetName;
......
package com.jumeirah.common.enums;
/**
* 状态,0-审核中,1-进行中,2-已完成,99-取消
*/
public enum StrokeStatusEnum {
UNDER_REVIEW(0, "审核中"),
PROCESSING(1, "进行中"),
COMPLETED(2, "已完成"),
CANCEL(99, "取消");
/**
* 编号
*/
private final Integer id;
/**
* 名称
*/
private final String name;
StrokeStatusEnum(Integer id, String name) {
this.id = id;
this.name = name;
}
}
package com.jumeirah.common.enums;
/**
* 行程类型,0-单程,1-往返行程,2-货运,3-医疗
*/
public enum StrokeTypeEnum {
ONE_WAY(0, "单程"),
ROUND_TRIP(1, "往返"),
CARGO_FLIGHT(2, "货运"),
MEDICAL_FLIGHT(3, "医疗");
/**
* 编号
*/
private final Integer id;
/**
* 名称
*/
private final String name;
StrokeTypeEnum(Integer id, String name) {
this.id = id;
this.name = name;
}
}
package com.jumeirah.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
......@@ -22,21 +21,21 @@ import java.io.Serializable;
@Repository
public interface StrokeMapper extends BaseMapper<Stroke> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
StrokeQueryVo getStrokeById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param strokePageParam
* @return
*/
IPage<StrokeQueryVo> getStrokePageList(@Param("page") Page page,@Param("param") StrokePageParam strokePageParam);
}
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
StrokeDetailVo getStrokeById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param strokePageParam
* @return
*/
IPage<StrokeQueryVo> getStrokePageList(@Param("page") Page page, @Param("param") StrokePageParam strokePageParam, @Param("userId") Long userId);
}
package com.jumeirah.common.param;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
/**
* <pre>
......@@ -18,6 +19,10 @@ import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "行程表分页参数")
public class StrokePageParam extends BasePageOrderParam{
private static final long serialVersionUID=1L;
}
public class StrokePageParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty("行程状态,-1=全部, 0-审核中,1-进行中,2-已完成")//99-取消
private Integer status;
}
......@@ -2,8 +2,9 @@ package com.jumeirah.common.service;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.param.StrokePageParam;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
......@@ -48,7 +49,7 @@ public interface StrokeService extends BaseService<Stroke> {
* @return
* @throws Exception
*/
StrokeQueryVo getStrokeById(Long id) throws Exception;
StrokeDetailVo getStrokeById(Long id) throws Exception;
/**
* 获取分页对象
......
......@@ -27,7 +27,6 @@ import io.geekidea.springbootplus.framework.shiro.vo.LoginUserVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -93,13 +92,15 @@ public class AppUserServiceImpl extends BaseServiceImpl<AppUserMapper, AppUser>
if (appUser == null) {
log.error("登录失败,用户名或密码错误 loginParam:{}", loginParam);
return ApiResult.fail(ApiCode.PWD_OR_USERNAME_ERROR, language);
return ApiResult.fail(ApiCode.USER_NOT_FOUND, language);
}
if (StateEnum.DISABLE.getCode().equals(appUser.getState())) {
throw new AuthenticationException("账号已禁用");
}
// throw new AuthenticationException("账号已禁用");
log.error("登录失败,账号已禁用 loginParam:{}", loginParam);
return ApiResult.fail(ApiCode.USER_NOT_FOUND, language);
// 将系统用户对象转换成登录用户对象
}
// 将系统用户对象转换成登录用户对象
LoginUserVo loginSysUserVo = new LoginUserVo();
loginSysUserVo.setId(appUser.getId());
......@@ -140,7 +141,7 @@ public class AppUserServiceImpl extends BaseServiceImpl<AppUserMapper, AppUser>
loginAppUserTokenVo.setToken(token);
loginAppUserTokenVo.setId(appUser.getId());
loginAppUserTokenVo.setHasRegister(hasRegister);
return ApiResult.ok(loginAppUserTokenVo, language);
return ApiResult.ok(loginAppUserTokenVo);
}
......
......@@ -184,7 +184,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
// 设置token响应头
response.setHeader(JwtTokenUtil.getTokenName(), loginSysUserTokenVo.getToken());
return ApiResult.ok(loginSysUserTokenVo, language);
return ApiResult.ok(loginSysUserTokenVo);
}
......
package com.jumeirah.common.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.mapper.StrokeMapper;
import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 行程表 服务实现类
......@@ -44,18 +47,29 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteStroke(Long id) throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke byId = super.getById(id);
// 判断该记录是否属于此用户
if (!byId.getUserId().equals(jwtToken.getUserId())) {
return false;
}
return super.removeById(id);
}
@Override
public StrokeQueryVo getStrokeById(Long id) throws Exception {
public StrokeDetailVo getStrokeById(Long id) throws Exception {
return strokeMapper.getStrokeById(id);
}
@Override
public Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam) throws Exception {
Page<StrokeQueryVo> page = new PageInfo<>(strokePageParam, OrderItem.desc(getLambdaColumn(Stroke::getCreateTime)));
IPage<StrokeQueryVo> iPage = strokeMapper.getStrokePageList(page, strokePageParam);
Page<StrokeQueryVo> page = new PageInfo<>(strokePageParam, OrderItem.asc(getLambdaColumn(Stroke::getCreateTime)));
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
IPage<StrokeQueryVo> iPage = strokeMapper.getStrokePageList(page, strokePageParam, jwtToken.getUserId());
return new Paging<StrokeQueryVo>(iPage);
}
......
......@@ -189,7 +189,7 @@ public class SysLoginServiceImpl implements SysLoginService {
// 设置token响应头
response.setHeader(JwtTokenUtil.getTokenName(), loginSysUserTokenVo.getToken());
return ApiResult.ok(loginSysUserTokenVo, language);
return ApiResult.ok(loginSysUserTokenVo);
}
@Override
......
package com.jumeirah.common.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <pre>
* 行程表 查询结果对象
* </pre>
*
* @author wei
* @date 2020-09-29
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "StrokeDetailVo对象")
public class StrokeDetailVo implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("主键ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@NotNull(message = "出发城市id不能为空")
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@ApiModelProperty("逻辑删除,0:未删除,1:已删除")
@TableLogic
private Integer deleted;
@NotBlank(message = "出发城市名称不能为空")
@ApiModelProperty("出发城市名称")
private String cityOutsetName;
@NotNull(message = "到达城市id不能为空")
@ApiModelProperty("到达城市id")
private Long cityArriveId;
@NotBlank(message = "到达城市名称不能为空")
@ApiModelProperty("到达城市名称")
private String cityArriveName;
@NotNull(message = "人数不能为空")
@ApiModelProperty("人数")
private Integer peopleMun;
@NotNull(message = "飞机型号ID不能为空")
@ApiModelProperty("飞机型号ID")
private Long plainTypeId;
@NotNull(message = "出发时间不能为空")
@ApiModelProperty("出发时间")
private Long outsetTime;
@ApiModelProperty("返程时间")
private Long returnTime;
@NotNull(message = "行程类型,0-单程,1-往返行程,2-货运,3-医疗不能为空")
@ApiModelProperty("行程类型,0-单程,1-往返行程,2-货运,3-医疗")
private Integer type;
@NotNull(message = "状态,0-审核中,1-进行中,2-已完成,99-取消不能为空")
@ApiModelProperty("状态,0-审核中,1-进行中,2-已完成,99-取消")
private Integer status;
@NotNull(message = "创建时间不能为空")
@ApiModelProperty("创建时间")
private Long createTime;
@ApiModelProperty("更新时间")
private Long updateTime;
@ApiModelProperty("货物名称")
private String goodsName;
@ApiModelProperty("货物体积(长*宽*高) 单位:CM,例如:100*102*120")
private String goodsSize;
@ApiModelProperty("货物重量,单位:吨")
private Double goodsWeight;
@ApiModelProperty("病人疾病名称")
private String diseaseName;
@ApiModelProperty("病人病情诊断书")
private String medicalCertificateUrl;
@ApiModelProperty("配备器械(格式:1,2,3)逗号分隔")
private String instruments;
@ApiModelProperty("医护人员,0-医生,1-护士,2-护工(格式:0,1,2)逗号分隔")
private String medicalPersons;
@ApiModelProperty("备注")
private String remarks;
@ApiModelProperty("价格,单位:分")
private Long money;
@NotNull(message = "用户ID不能为空")
@ApiModelProperty("用户ID")
private Long userId;
@NotNull(message = "商家id不能为空")
@ApiModelProperty("商家id")
private Long mcId;
@NotNull(message = "用户选择机型不能为空")
@ApiModelProperty("用户选择机型")
private Long choosePlainType;
}
\ No newline at end of file
package com.jumeirah.common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <pre>
......@@ -18,75 +18,36 @@ import java.util.Date;
@Data
@Accessors(chain = true)
@ApiModel(value = "StrokeQueryVo对象")
public class StrokeQueryVo implements Serializable{
private static final long serialVersionUID=1L;
public class StrokeQueryVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
private Long id;
@ApiModelProperty("出发城市名称")
private String cityOutsetName;
@ApiModelProperty("到达城市id")
private Long cityArriveId;
private String cityOutsetName;
@ApiModelProperty("到达城市名称")
private String cityArriveName;
@ApiModelProperty("人数")
private Integer peopleMun;
@ApiModelProperty("飞机型号ID")
private Long plainTypeId;
private String cityArriveName;
@ApiModelProperty("出发时间")
private Date outsetTime;
private Long outsetTime;
@ApiModelProperty("返程时间")
private Date returnTime;
private Long returnTime;
@ApiModelProperty("行程类型,0-单程,1-往返行程,2-货运,3-医疗")
private Integer type;
private Integer type;
@ApiModelProperty("状态,0-审核中,1-进行中,2-已完成,99-取消")
private Integer status;
@ApiModelProperty("创建时间")
private Long createTime;
@ApiModelProperty("更新时间")
private Long updateTime;
@ApiModelProperty("货物名称")
private String goodsName;
@ApiModelProperty("货物体积(长*宽*高) 单位:CM,例如:100*102*120")
private String goodsSize;
@ApiModelProperty("货物重量,单位:吨")
private Double goodsWeight;
@ApiModelProperty("病人疾病名称")
private String diseaseName;
@ApiModelProperty("病人病情诊断书")
private String aegerUrl;
@ApiModelProperty("配备器械(格式:1,2,3)逗号分隔")
private String instruments;
@ApiModelProperty("医护人员,0-医生,1-护士,2-护工(格式:0,1,2)逗号分隔")
private String medicalPersons;
private Integer status;
@ApiModelProperty("备注")
private String remarks;
private String remarks;
@ApiModelProperty("价格,单位:分")
private Long money;
private Long money;
@ApiModelProperty("用户ID")
private Long userId;
private Long userId;
}
\ No newline at end of file
......@@ -2,21 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jumeirah.common.mapper.StrokeMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, city_outset_id, city_outset_name, city_arrive_id, city_arrive_name, people_mun, plain_type_id, outset_time, return_time, type, status, create_time, update_time, goods_name, goods_size, goods_weight, disease_name, aeger_url, instruments, medical_persons, remarks, money, user_id
<!-- 通用查询结果列 -->
<sql id="Page_Column_List">
id, city_outset_id, city_outset_name, city_arrive_id, city_arrive_name, people_mun, plain_type_id, outset_time, return_time, type, status, money, user_id
</sql>
<select id="getStrokeById" resultType="com.jumeirah.common.vo.StrokeQueryVo">
select
<include refid="Base_Column_List"/>
from stroke where id = #{id}
</select>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, city_outset_id, deleted, city_outset_name, city_arrive_id, city_arrive_name, people_mun, plain_type_id, outset_time, return_time, type, status, create_time, update_time, goods_name, goods_size, goods_weight, disease_name, instruments, medical_persons, remarks, money, user_id
</sql>
<select id="getStrokeById" resultType="com.jumeirah.common.vo.StrokeDetailVo">
select
<include refid="Base_Column_List"/>
from stroke where id = #{id}
</select>
<select id="getStrokePageList" parameterType="com.jumeirah.common.param.StrokePageParam"
resultType="com.jumeirah.common.vo.StrokeQueryVo">
select
<include refid="Page_Column_List"/>
from stroke
<where>
and user_id = #{userId}
and deleted = 0
<select id="getStrokePageList" parameterType="com.jumeirah.common.param.StrokePageParam" resultType="com.jumeirah.common.vo.StrokeQueryVo">
select
<include refid="Base_Column_List"/>
from stroke
</select>
<if test="param.status != -1">
-- -1: 查询全部
and `status` = #{param.status}
</if>
</where>
</select>
</mapper>
#/**
#* 操作成功
#**/
api.response.code.SUCCESS=SUCCESS
api.response.code.SUCCESS=success
#/**
#* 非法访问
#**/
......@@ -75,4 +75,6 @@ api.response.code.JWTDECODE_EXCEPTION=JWTDECODE_EXCEPTION
#* 默认的异常处理
#*/
api.response.code.HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION=HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION
api.response.code.user.PWD_OR_USERNAME_ERROR=password or phone number error
\ No newline at end of file
api.response.code.user.PWD_OR_USERNAME_ERROR=password or phone number error
api.response.code.user.SMS_CODE_ERROR=sms code error
api.response.code.user.USER_NOT_FOUND=user not found
\ No newline at end of file
......@@ -75,4 +75,6 @@ api.response.code.JWTDECODE_EXCEPTION=JWTDECODE_EXCEPTION
#* 默认的异常处理
#*/
api.response.code.HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION=HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION
api.response.code.user.PWD_OR_USERNAME_ERROR=password or phone number error KH
\ No newline at end of file
api.response.code.user.PWD_OR_USERNAME_ERROR=password or phone number error KH
api.response.code.user.SMS_CODE_ERROR=sms code error
api.response.code.user.USER_NOT_FOUND=user not found
\ No newline at end of file
......@@ -75,4 +75,6 @@ api.response.code.JWTDECODE_EXCEPTION=Token解析异常
#* 默认的异常处理
#*/
api.response.code.HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION=默认的异常处理
api.response.code.user.PWD_OR_USERNAME_ERROR=账号或密码错误
\ No newline at end of file
api.response.code.user.PWD_OR_USERNAME_ERROR=账号或密码错误
api.response.code.user.SMS_CODE_ERROR=验证码错误
api.response.code.user.USER_NOT_FOUND=用户不存在
\ No newline at end of file
......@@ -107,7 +107,16 @@ public enum ApiCode {
/**
* 账号或密码错误
*/
PWD_OR_USERNAME_ERROR(6001, "api.response.code.user.PWD_OR_USERNAME_ERROR");
PWD_OR_USERNAME_ERROR(6001, "api.response.code.user.PWD_OR_USERNAME_ERROR"),
/**
* 验证码错误
*/
SMS_CODE_ERROR(6002, "api.response.code.user.SMS_CODE_ERROR"),
/**
* 用户不存在
*/
USER_NOT_FOUND(6003, "api.response.code.user.USER_NOT_FOUND");
private final int code;
private final String message;
......
......@@ -84,27 +84,21 @@ public class ApiResult<T> implements Serializable {
return fail();
}
public static ApiResult<Boolean> result(boolean flag, String language) {
if (flag) {
return ok(null, language);
}
return fail(language);
}
public static ApiResult<Boolean> result(ApiCode apiCode) {
return result(apiCode, null);
}
public static <T> ApiResult<T> result(ApiCode apiCode, T data) {
return result(apiCode, null, data, null);
return result(apiCode, null, data);
}
public static <T> ApiResult<T> result(ApiCode apiCode, T data, String language) {
return result(apiCode, null, data, language);
return result(apiCode, null, data);
}
public static <T> ApiResult<T> result(ApiCode apiCode, String message, T data, String language) {
public static <T> ApiResult<T> result(ApiCode apiCode, String message, T data) {
// boolean success = false;
// if (apiCode.getCode() == ApiCode.SUCCESS.getCode()) {
// success = true;
......@@ -112,7 +106,7 @@ public class ApiResult<T> implements Serializable {
// 多语言国际化,根据http上下文, 取得heard中的language语言属性,实现不用在业务代码中传递语言字段
HttpServletRequest request = HttpServletRequestUtil.getRequest();
language = request.getHeader("language");
String language = request.getHeader("language");
String success = "SUCCESS";
try {
......@@ -139,9 +133,6 @@ public class ApiResult<T> implements Serializable {
return result(ApiCode.SUCCESS, data);
}
public static <T> ApiResult<T> ok(T data, String language) {
return result(ApiCode.SUCCESS, data, language);
}
// public static <T> ApiResult<T> ok(T data, String message) {
// return result(ApiCode.SUCCESS, message, data);
......@@ -158,14 +149,10 @@ public class ApiResult<T> implements Serializable {
}
public static <T> ApiResult<T> fail(ApiCode apiCode, String language) {
return result(apiCode, null, language);
return result(apiCode, null);
}
// public static ApiResult<String> fail(String message) {
// return result(ApiCode.FAIL, message, null);
// }
public static <T> ApiResult<T> fail(ApiCode apiCode, T data) {
if (ApiCode.SUCCESS == apiCode) {
throw new RuntimeException("失败结果状态码不能为" + ApiCode.SUCCESS.getCode());
......@@ -173,13 +160,6 @@ public class ApiResult<T> implements Serializable {
return result(apiCode, data);
}
public static <T> ApiResult<T> fail(ApiCode apiCode, T data, String language) {
if (ApiCode.SUCCESS == apiCode) {
throw new RuntimeException("失败结果状态码不能为" + ApiCode.SUCCESS.getCode());
}
return result(apiCode, data, language);
}
public static ApiResult<String> fail(Integer errorCode, String message) {
return new ApiResult<String>()
// .setSuccess(false)
......
......@@ -16,10 +16,10 @@ public enum LanguageEnum {
*/
LANGUAGE_EN_US("en_US"),
/**
* 柬埔寨 高棉语
*/
LANGUAGE_KH("kh"),
// /**
// * 柬埔寨 高棉语
// */
// LANGUAGE_KH("kh"),
/**
* 简体中文
......
......@@ -36,7 +36,7 @@ import java.util.List;
@EqualsAndHashCode(callSuper = true)
@ApiModel("可排序查询参数对象")
public abstract class BasePageOrderParam extends BasePageParam {
private static final long serialVersionUID = 57714391204790143L;
private static final long serialVersionUID = 57714391204790143L;
@ApiModelProperty("排序")
private List<OrderItem> pageSorts;
......
......@@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
/**
* 获取当前请求的HttpServletRequest对象
* http上下文对象
*
* @author geekidea
* @date 2018-11-08
......
......@@ -51,7 +51,6 @@ import org.springframework.web.bind.annotation.*;
#end
@RequestMapping("/${cfg.entityObjectName}")
#if(${cfg.operationLog})
@Module("${cfg.module}")
#end
#if(${cfg.swaggerTags})
@Api(value = "$!{table.comment}API", tags = {"$!{table.comment}"})
......
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