Commit df0e88c8 authored by mlchun's avatar mlchun

1.机构订单接口完成

parent 31e4dbbc
...@@ -209,14 +209,14 @@ public class PensionOrderController { ...@@ -209,14 +209,14 @@ public class PensionOrderController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , @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.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = "status", value = "订单状态: 0未接单 1已派发 2已完成 3已取消 5已接单未派发", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = "status", value = "订单状态: 0未接单 1已派发 2已完成 3已取消 5已接单未派发", paramType = "query", dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
}) })
public Result<PageData<PensionOrderDTO>> organization(@ApiIgnore @LoginUser UserEntity user, public Result<PageData<PensionOrderDTO>> organization(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){ @ApiIgnore @RequestParam Map<String, Object> params){
//TODO 登录->查询登录人员所属机构ID->机构ID查询服务ID(List)->服务ID + 状态查询订单(List) //登录->查询登录人员所属机构ID->机构ID查询服务ID(List)->服务ID + 状态查询订单(List)
PageData<PensionOrderDTO> page = pensionOrderService.getOrderPageByStatus(params, user.getId(), Integer.parseInt(params.get("status").toString())); PageData<PensionOrderDTO> page = pensionOrderService.getOrganizationOrder(params, user.getId());
return new Result<PageData<PensionOrderDTO>>().ok(page); return new Result<PageData<PensionOrderDTO>>().ok(page);
} }
......
...@@ -64,4 +64,11 @@ public interface PensionOrderDao extends BaseDao<PensionOrderEntity> { ...@@ -64,4 +64,11 @@ public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
*/ */
IPage<PensionOrderDTO> getElderAllOrderByCommunityUserIdPage(IPage<PensionOrderEntity> page, Long userId, String appointmentPerson); IPage<PensionOrderDTO> getElderAllOrderByCommunityUserIdPage(IPage<PensionOrderEntity> page, Long userId, String appointmentPerson);
/**
* 根据服务Id查询订单
* @param serviceId
* @return
*/
List<PensionOrderDTO> getAllOrderByServiceId(Long serviceId, Integer status);
} }
...@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao; ...@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.PensionOrganizationServiceEntity; import io.hmit.modules.serviceOrder.entity.PensionOrganizationServiceEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 机构服务关系 * 机构服务关系
* *
...@@ -12,5 +14,12 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,5 +14,12 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface PensionOrganizationServiceDao extends BaseDao<PensionOrganizationServiceEntity> { public interface PensionOrganizationServiceDao extends BaseDao<PensionOrganizationServiceEntity> {
/**
* 根据用户Id查询出机构的全部服务ID
* @param userId
* @return
*/
List<Long> findServiceIdListByServiceUserId(Long userId);
} }
\ No newline at end of file
...@@ -44,4 +44,7 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen ...@@ -44,4 +44,7 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//社工:查询本社区某老人全部订单(模糊查询) //社工:查询本社区某老人全部订单(模糊查询)
PageData<PensionOrderDTO> getElderAllOrderByCommunityUserIdPage(Map<String, Object> params, Long userId, String appointmentPerson); PageData<PensionOrderDTO> getElderAllOrderByCommunityUserIdPage(Map<String, Object> params, Long userId, String appointmentPerson);
//查询机构订单
PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId);
} }
...@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService; ...@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrganizationDTO; import io.hmit.modules.serviceOrder.dto.PensionOrganizationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity; import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity;
import java.util.List;
/** /**
* 机构表 * 机构表
* *
...@@ -12,4 +14,6 @@ import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity; ...@@ -12,4 +14,6 @@ import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity;
*/ */
public interface PensionOrganizationService extends CrudService<PensionOrganizationEntity, PensionOrganizationDTO> { public interface PensionOrganizationService extends CrudService<PensionOrganizationEntity, PensionOrganizationDTO> {
List<Long> findServiceIdListByServiceUserId(Long userId);
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ import io.hmit.modules.serviceOrder.dto.ReservationDTO; ...@@ -13,6 +13,7 @@ import io.hmit.modules.serviceOrder.dto.ReservationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity; import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderService; import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.hmit.modules.serviceOrder.service.PensionOrderServiceService; import io.hmit.modules.serviceOrder.service.PensionOrderServiceService;
import io.hmit.modules.serviceOrder.service.PensionOrganizationService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,6 +47,9 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -46,6 +47,9 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Autowired @Autowired
private PensionOrderServiceService pensionOrderServiceService; private PensionOrderServiceService pensionOrderServiceService;
@Autowired
private PensionOrganizationService pensionOrganizationService;
//查询全部订单 //查询全部订单
@Override @Override
public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) { public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) {
...@@ -130,4 +134,22 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -130,4 +134,22 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class); return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class);
} }
@Override
public PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId) {
//登录->查询登录人员所属机构ID->机构ID查询服务ID(List)->服务ID + 状态查询订单(List)
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
List<Long> serviceIds = pensionOrganizationService.findServiceIdListByServiceUserId(userId);
Integer status = null;
if (null != params.get("status")) {
status = Integer.parseInt(params.get("status").toString());
}
List<PensionOrderDTO> result = new ArrayList<>();
for (Long id : serviceIds) {
List<PensionOrderDTO> list = pensionOrderDao.getAllOrderByServiceId(id, status);
result.addAll(list);
}
page.setTotal(result.size());
return getPageData(result, page.getTotal(), PensionOrderDTO.class);
}
} }
...@@ -3,12 +3,15 @@ package io.hmit.modules.serviceOrder.service.impl; ...@@ -3,12 +3,15 @@ package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionOrganizationDao; import io.hmit.modules.serviceOrder.dao.PensionOrganizationDao;
import io.hmit.modules.serviceOrder.dao.PensionOrganizationServiceDao;
import io.hmit.modules.serviceOrder.dto.PensionOrganizationDTO; import io.hmit.modules.serviceOrder.dto.PensionOrganizationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity; import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity;
import io.hmit.modules.serviceOrder.service.PensionOrganizationService; import io.hmit.modules.serviceOrder.service.PensionOrganizationService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -30,5 +33,12 @@ public class PensionOrganizationServiceImpl extends CrudServiceImpl<PensionOrgan ...@@ -30,5 +33,12 @@ public class PensionOrganizationServiceImpl extends CrudServiceImpl<PensionOrgan
return wrapper; return wrapper;
} }
@Autowired
private PensionOrganizationServiceDao pensionOrganizationServiceDao;
@Override
public List<Long> findServiceIdListByServiceUserId(Long userId) {
return pensionOrganizationServiceDao.findServiceIdListByServiceUserId(userId);
}
} }
\ No newline at end of file
...@@ -143,4 +143,18 @@ ...@@ -143,4 +143,18 @@
AND tu.id = #{userId} AND po.appointment_person LIKE CONCAT('%', #{appointmentPerson}, '%') AND tu.id = #{userId} AND po.appointment_person LIKE CONCAT('%', #{appointmentPerson}, '%')
</select> </select>
<select id="getAllOrderByServiceId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id,
po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon
FROM pension_order po, pension_service ps
WHERE po.service_id = ps.id AND po.service_id = #{serviceId}
<if test="status != null">
AND po.status = #{status}
</if>
</select>
</mapper> </mapper>
...@@ -11,5 +11,9 @@ ...@@ -11,5 +11,9 @@
<result property="createDate" column="create_date"/> <result property="createDate" column="create_date"/>
</resultMap> </resultMap>
<select id="findServiceIdListByServiceUserId" resultType="Long">
SELECT pos.service_id FROM pension_organization_user pou, pension_organization_service pos
WHERE pou.organization_id = pos.organization_id and pou.user_id = #{userId}
</select>
</mapper> </mapper>
\ No newline at end of file
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