Commit 426f8d17 by testdl

# 用户下单功能

parent 7be595f9
...@@ -13,20 +13,13 @@ import io.geekidea.springbootplus.framework.log.enums.OperationLogType; ...@@ -13,20 +13,13 @@ import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
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.apache.commons.collections.list.PredicatedList;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -39,7 +32,7 @@ import java.util.stream.Collectors; ...@@ -39,7 +32,7 @@ import java.util.stream.Collectors;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/plainType") @RequestMapping("/app/plainType")
@Module("${cfg.module}") @Module("${cfg.module}")
@Api(value = "飞机型号表API", tags = {"飞机型号表"}) @Api(value = "飞机型号表API", tags = {"飞机型号表"})
public class PlainTypeController extends BaseController { public class PlainTypeController extends BaseController {
...@@ -54,7 +47,7 @@ public class PlainTypeController extends BaseController { ...@@ -54,7 +47,7 @@ public class PlainTypeController extends BaseController {
@OperationLog(name = "分组获取飞机型号列表", type = OperationLogType.PAGE) @OperationLog(name = "分组获取飞机型号列表", type = OperationLogType.PAGE)
@ApiOperation(value = "分组获取飞机型号列表", response = PlainTypeQueryVo.class) @ApiOperation(value = "分组获取飞机型号列表", response = PlainTypeQueryVo.class)
public ApiResult<List<PlainTypeBo>> getAllMap() throws Exception { public ApiResult<List<PlainTypeBo>> getAllMap() throws Exception {
List<PlainType> plainTypeList = plainTypeService.getAllMap(); List<PlainType> plainTypeList = plainTypeService.getAllMap();
Map<Integer, List<PlainType>> resultMap; Map<Integer, List<PlainType>> resultMap;
List<PlainTypeBo> plainTypeBoList = new ArrayList<>(); List<PlainTypeBo> plainTypeBoList = new ArrayList<>();
if (!CollectionUtils.isEmpty(plainTypeList)) { if (!CollectionUtils.isEmpty(plainTypeList)) {
......
...@@ -55,7 +55,8 @@ public class StrokeController extends BaseController { ...@@ -55,7 +55,8 @@ public class StrokeController extends BaseController {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke stroke = new Stroke(); Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeAddOneWayVo, stroke); BeanUtils.copyProperties(strokeAddOneWayVo, stroke);
stroke.setType(0); stroke.setType(0)
.setUserId(jwtToken.getUserId());
boolean flag = strokeService.saveStroke(stroke); boolean flag = strokeService.saveStroke(stroke);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
...@@ -70,7 +71,8 @@ public class StrokeController extends BaseController { ...@@ -70,7 +71,8 @@ public class StrokeController extends BaseController {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke stroke = new Stroke(); Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeAddBackAndForthVo, stroke); BeanUtils.copyProperties(strokeAddBackAndForthVo, stroke);
stroke.setType(1); stroke.setType(1)
.setUserId(jwtToken.getUserId());
boolean flag = strokeService.saveStroke(stroke); boolean flag = strokeService.saveStroke(stroke);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
...@@ -85,7 +87,8 @@ public class StrokeController extends BaseController { ...@@ -85,7 +87,8 @@ public class StrokeController extends BaseController {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke stroke = new Stroke(); Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeAddFreightVo, stroke); BeanUtils.copyProperties(strokeAddFreightVo, stroke);
stroke.setType(2); stroke.setType(2)
.setUserId(jwtToken.getUserId());
boolean flag = strokeService.saveStroke(stroke); boolean flag = strokeService.saveStroke(stroke);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
...@@ -101,7 +104,8 @@ public class StrokeController extends BaseController { ...@@ -101,7 +104,8 @@ public class StrokeController extends BaseController {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal(); JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
Stroke stroke = new Stroke(); Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeAddMedicalTreatmentVo, stroke); BeanUtils.copyProperties(strokeAddMedicalTreatmentVo, stroke);
stroke.setType(3); stroke.setType(3)
.setUserId(jwtToken.getUserId());
boolean flag = strokeService.saveStroke(stroke); boolean flag = strokeService.saveStroke(stroke);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
......
package com.jumeirah.api.merchant.controller.order;
import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.param.McStrokePageParam;
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.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.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.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-29
*/
@Slf4j
@RestController
@RequestMapping("/merchant/stroke")
@Api(value = "行程API", tags = {"行程"})
public class McStrokeController extends BaseController {
@Autowired
private StrokeService strokeService;
/**
* 修改行程表
*/
@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);
}
/**
* 行程表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "行程分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程分页列表")
public ApiResult<Paging<McStrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody McStrokePageParam mcStrokePageParam) throws Exception {
Paging<McStrokeQueryVo> paging = strokeService.getMcStrokePageList(mcStrokePageParam);
return ApiResult.ok(paging);
}
}
...@@ -15,6 +15,8 @@ import javax.validation.constraints.NotNull; ...@@ -15,6 +15,8 @@ import javax.validation.constraints.NotNull;
import io.geekidea.springbootplus.framework.core.validator.groups.Update; import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import java.sql.Timestamp;
/** /**
* 飞机型号表 * 飞机型号表
* *
...@@ -55,10 +57,10 @@ public class PlainType extends BaseEntity { ...@@ -55,10 +57,10 @@ public class PlainType extends BaseEntity {
@NotNull(message = "创建时间(时间戳)不能为空") @NotNull(message = "创建时间(时间戳)不能为空")
@ApiModelProperty("创建时间(时间戳)") @ApiModelProperty("创建时间(时间戳)")
private Long createTime; private Timestamp createTime;
@ApiModelProperty("更新时间(时间戳)") @ApiModelProperty("更新时间(时间戳)")
private Long updateTime; private Timestamp updateTime;
@ApiModelProperty("宽 单位:像素") @ApiModelProperty("宽 单位:像素")
private Integer width; private Integer width;
......
...@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.entity.Stroke; import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.StrokePageParam; import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.vo.McStrokeQueryVo;
import com.jumeirah.common.vo.StrokeDetailVo; import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo; import com.jumeirah.common.vo.StrokeQueryVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -38,4 +40,12 @@ public interface StrokeMapper extends BaseMapper<Stroke> { ...@@ -38,4 +40,12 @@ public interface StrokeMapper extends BaseMapper<Stroke> {
*/ */
IPage<StrokeQueryVo> getStrokePageList(@Param("page") Page page, @Param("param") StrokePageParam strokePageParam, @Param("userId") Long userId); IPage<StrokeQueryVo> getStrokePageList(@Param("page") Page page, @Param("param") StrokePageParam strokePageParam, @Param("userId") Long userId);
/**
* 商家端 获取行程分页对象
*
* @param page
* @param mcStrokePageParam
* @return
*/
IPage<McStrokeQueryVo> getMcStrokePageList(@Param("page") Page page, @Param("mcStrokePageParam") McStrokePageParam mcStrokePageParam);
} }
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;
/**
* <pre>
* 行程表 分页参数对象
* </pre>
*
* @author wei
* @date 2020-09-29
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "行程表分页参数")
public class McStrokePageParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty("行程类型,0-单程,1-往返行程,2-货运,3-医疗")
private Integer type;
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("开始时间")
private String startTime;
@ApiModelProperty("结束时间")
private String endTime;
@ApiModelProperty("申请人")
private String applicant;
}
package com.jumeirah.common.service; package com.jumeirah.common.service;
import com.jumeirah.common.entity.Stroke; import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.StrokePageParam; import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.vo.McStrokeQueryVo;
import com.jumeirah.common.vo.StrokeDetailVo; import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo; import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.service.BaseService; import io.geekidea.springbootplus.framework.common.service.BaseService;
...@@ -60,4 +62,10 @@ public interface StrokeService extends BaseService<Stroke> { ...@@ -60,4 +62,10 @@ public interface StrokeService extends BaseService<Stroke> {
*/ */
Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam) throws Exception; Paging<StrokeQueryVo> getStrokePageList(StrokePageParam strokePageParam) throws Exception;
/**
* 商家端,分页获取行程接口
* @param mcStrokePageParam
* @return
*/
Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam);
} }
...@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem; ...@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.entity.Stroke; import com.jumeirah.common.entity.Stroke;
import com.jumeirah.common.mapper.StrokeMapper; import com.jumeirah.common.mapper.StrokeMapper;
import com.jumeirah.common.param.McStrokePageParam;
import com.jumeirah.common.param.StrokePageParam; import com.jumeirah.common.param.StrokePageParam;
import com.jumeirah.common.service.StrokeService; import com.jumeirah.common.service.StrokeService;
import com.jumeirah.common.vo.McStrokeQueryVo;
import com.jumeirah.common.vo.StrokeDetailVo; import com.jumeirah.common.vo.StrokeDetailVo;
import com.jumeirah.common.vo.StrokeQueryVo; import com.jumeirah.common.vo.StrokeQueryVo;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl; import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
...@@ -73,4 +75,11 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp ...@@ -73,4 +75,11 @@ public class StrokeServiceImpl extends BaseServiceImpl<StrokeMapper, Stroke> imp
return new Paging<StrokeQueryVo>(iPage); return new Paging<StrokeQueryVo>(iPage);
} }
@Override
public Paging<McStrokeQueryVo> getMcStrokePageList(McStrokePageParam mcStrokePageParam) {
Page<StrokeQueryVo> page = new PageInfo<>(mcStrokePageParam, OrderItem.asc(getLambdaColumn(Stroke::getCreateTime)));
IPage<McStrokeQueryVo> mcStrokePageList = strokeMapper.getMcStrokePageList(page, mcStrokePageParam);
return new Paging<McStrokeQueryVo>(mcStrokePageList);
}
} }
package com.jumeirah.common.vo;
import com.jumeirah.common.entity.Stroke;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <pre>
* 行程表 查询结果对象
* </pre>
*
* @author wei
* @date 2020-09-29
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "StrokeQueryVo对象")
public class McStrokeQueryVo extends Stroke implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("申请人")
private String applicant;
@ApiModelProperty("手机号")
private String phoneNumber;
}
...@@ -50,5 +50,37 @@ ...@@ -50,5 +50,37 @@
</if> </if>
</where> </where>
</select> </select>
<select id="getMcStrokePageList" parameterType="com.jumeirah.common.param.McStrokePageParam"
resultType="com.jumeirah.common.vo.McStrokeQueryVo">
SELECT
s.*,
CONCAT( au.surname, au.`name` ) AS applicant,
au.phone AS phone_number
FROM
stroke s
LEFT JOIN app_user au ON au.id = s.user_id
<where>
<if test="mcStrokePageParam.type !=null">
AND s.type = #{mcStrokePageParam.type}
</if>
<if test="mcStrokePageParam.id !=null">
AND s.id = #{mcStrokePageParam.id}
</if>
<if test="mcStrokePageParam.startTime !=null and mcStrokePageParam.startTime != ''">
AND s.create_time &gt;= #{mcStrokePageParam.startTime}
</if>
<if test="mcStrokePageParam.endTime !=null and mcStrokePageParam.endTime != ''">
AND s.create_time &lt;= #{mcStrokePageParam.endTime}
</if>
<if test="mcStrokePageParam.applicant !=null and mcStrokePageParam.applicant != ''">
AND CONCAT( au.surname, au.`name` ) LIKE CONCAT('%',#{mcStrokePageParam.applicant},'%')
</if>
</where>
WHERE
s.type = 2
AND s.id = 1
AND (s.create_time BETWEEN '2020-10-07 15:32:30' AND '2020-10-12 15:32:30')
AND CONCAT( au.surname, au.`name` ) LIKE '%姓名'
</select>
</mapper> </mapper>
...@@ -75,7 +75,7 @@ spring-boot-plus: ...@@ -75,7 +75,7 @@ spring-boot-plus:
order: 1 order: 1
async: true async: true
xss: xss:
enable: true enable: false
url-patterns: /* url-patterns: /*
order: 2 order: 2
async: true async: true
......
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