Commit 3d225969 authored by lings's avatar lings

Merge remote-tracking branch 'origin/master'

parents f2a11129 e6b6e9da
package io.hmit.modules.serviceOrder.controller;
import io.hmit.annotation.Login;
import io.hmit.annotation.LoginUser;
import io.hmit.common.constant.Constant;
......@@ -13,7 +12,6 @@ import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -27,7 +25,6 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.Date;
import java.util.Map;
/**
* 订单表
*
......@@ -75,7 +72,7 @@ public class PensionOrderController {
@Login
@GetMapping("incompleteOrderPage")
@ApiOperation("未完成订单分页")
@ApiOperation(value = "未完成订单分页", notes = "未完成和已接单类似,但此处返回状态为0的订单")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
......@@ -133,12 +130,54 @@ public class PensionOrderController {
return new Result<PageData<PensionOrderDTO>>().ok(page);
}
@Login
@GetMapping("noProceedOrderPage")
@ApiOperation("未接单分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<PensionOrderDTO>> noProceedOrderPage(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionOrderDTO> page = pensionOrderService.getNoProceedOrderPage(params);
return new Result<PageData<PensionOrderDTO>>().ok(page);
}
@Login
@GetMapping("orderInfo/{id}")
@ApiOperation("预约订单详情")
public Result<PensionOrderDTO> getOrderInfo(@ApiIgnore @LoginUser UserEntity user,
@PathVariable("id") Long id){
PensionOrderDTO data = pensionOrderService.getOrderInfoByIdAndUserId(id, user.getId());
return new Result<PensionOrderDTO>().ok(data);
}
@Login
@PutMapping("takingOrder/{id}")
@ApiOperation("接单")
public Result takingOrder(@ApiIgnore @LoginUser UserEntity user,
@PathVariable("id") Long id){
PensionOrderDTO pensionOrderDTO = pensionOrderService.getOrderInfoByIdAndStatus(id, 0);
Date recipientTime = new Date();
pensionOrderDTO.setOrderRecipientId(user.getId());
pensionOrderDTO.setOrderRecipientName(user.getUsername());
pensionOrderDTO.setOrderRecipientPhone(user.getMobile());
pensionOrderDTO.setOrderRecipientTime(recipientTime);
pensionOrderDTO.setUpdateDate(recipientTime);
pensionOrderDTO.setStatus(1); //TODO 后期添加到Constant或新建枚举类
pensionOrderDTO.setStatusName("已接单");
pensionOrderService.update(pensionOrderDTO);
return new Result();
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<PensionOrderDTO> get(@PathVariable("id") Long id){
PensionOrderDTO data = pensionOrderService.get(id);
return new Result<PensionOrderDTO>().ok(data);
// return new Result<PensionOrderDTO>().ok(data);
return null;
}
@PostMapping
......@@ -146,6 +185,15 @@ public class PensionOrderController {
public Result save(@RequestBody PensionOrderDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
dto.setId(null);
dto.setOrderNum(null);
dto.setStatus(0);
dto.setStatusName("未接单");
dto.setOrderRecipientTime(null);
dto.setOrderRecipientPhone(null);
dto.setOrderRecipientName(null);
dto.setOrderRecipientId(null);
//设置日期
dto.setCreateDate(new Date());
dto.setUpdateDate(new Date());
......
......@@ -19,4 +19,11 @@ public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
IPage<PensionOrderEntity> getTodayOrderPage(IPage<PensionOrderEntity> page, Long userId);
IPage<PensionOrderEntity> getOrderPageByStatus(IPage<PensionOrderEntity> page, Long userId, Integer status);
IPage<PensionOrderEntity> getNoProceedOrderPage(IPage<PensionOrderEntity> page);
PensionOrderEntity getOrderInfoByIdAndUserId(Long orderId, Long userId);
PensionOrderEntity getOrderInfoByIdAndStatus(Long orderId, Integer status);
}
\ No newline at end of file
......@@ -33,4 +33,13 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询已取消订单
PageData<PensionOrderDTO> getCanceledOrderPage(Map<String, Object> params, Long userId);
//查询未接单订单
PageData<PensionOrderDTO> getNoProceedOrderPage(Map<String, Object> params);
//查询预约订单详情
PensionOrderDTO getOrderInfoByIdAndUserId(Long id, Long userId);
//根据订单Id和订单状态查询
PensionOrderDTO getOrderInfoByIdAndStatus(Long orderId, Integer status);
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.serviceOrder.dao.PensionOrderDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
......@@ -87,4 +88,29 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getNoProceedOrderPage(Map<String, Object> params) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getNoProceedOrderPage(page);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PensionOrderDTO getOrderInfoByIdAndUserId(Long id, Long userId) {
PensionOrderEntity orderEntity = pensionOrderDao.getOrderInfoByIdAndUserId(id, userId);
orderEntity.setServiceId(null);
orderEntity.setOrderRecipientId(null);
orderEntity.setDeptId(null);
orderEntity.setCreator(null);
orderEntity.setUpdater(null);
orderEntity.setUpdateDate(null);
return ConvertUtils.sourceToTarget(orderEntity, PensionOrderDTO.class);
}
@Override
public PensionOrderDTO getOrderInfoByIdAndStatus(Long id, Integer status) {
PensionOrderEntity orderEntity = pensionOrderDao.getOrderInfoByIdAndStatus(id, status);
return ConvertUtils.sourceToTarget(orderEntity, PensionOrderDTO.class);
}
}
\ No newline at end of file
serviceOrder<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.hmit.modules.serviceOrder.dao.PensionDocumentDao">
......
......@@ -40,4 +40,16 @@
SELECT * FROM pension_order WHERE pension_order.status = #{status} and order_recipient_id = #{userId}
</select>
<select id="getNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.status = 0 AND order_recipient_id IS NULL
</select>
<select id="getOrderInfoByIdAndUserId" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.order_recipient_id = #{userId}
</select>
<select id="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status}
</select>
</mapper>
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