Commit f589bb98 authored by mlchun's avatar mlchun

1.添加机构处理接口

parent 52522226
...@@ -303,11 +303,11 @@ public class PensionOrderController { ...@@ -303,11 +303,11 @@ public class PensionOrderController {
} }
/** /**
* 机构全部人员 * 机构全部人员
*/ */
@Login @Login
@GetMapping("organizationStaff") @GetMapping("organizationStaff")
@ApiOperation(value = "机构全部人员(机构)") @ApiOperation(value = "机构全部人员(机构)")
@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") ,
...@@ -320,4 +320,24 @@ public class PensionOrderController { ...@@ -320,4 +320,24 @@ public class PensionOrderController {
return new Result<PageData<UserEntity>>().ok(page); return new Result<PageData<UserEntity>>().ok(page);
} }
/**
* 机构处理
*/
@Login
@GetMapping("organizationHandle")
@ApiOperation(value = "机构处理(机构)", notes = "传参为1(派单)时,recipient_id必传")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "订单ID", paramType = "query", required = true, dataType="long") ,
@ApiImplicitParam(name = "status", value = "处理状态: 5接单 1派单 3取消", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = "recipient_id", value = "接单服务人员ID", paramType = "query", dataType="long")
})
public Result organizationHandle(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){
Boolean result = pensionOrderService.organizationHandle(params, user.getId());
if (!result) {
return new Result().error();
}
return new Result();
}
} }
...@@ -47,4 +47,7 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen ...@@ -47,4 +47,7 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询机构订单 //查询机构订单
PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId); PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId);
Boolean organizationHandle(Map<String, Object> params, Long userId);
} }
...@@ -6,6 +6,8 @@ import io.hmit.common.constant.Constant; ...@@ -6,6 +6,8 @@ import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData; import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils; import io.hmit.common.utils.ConvertUtils;
import io.hmit.dao.UserDao;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dao.PensionOrderDao; import io.hmit.modules.serviceOrder.dao.PensionOrderDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderServiceDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderServiceDTO;
...@@ -14,11 +16,13 @@ import io.hmit.modules.serviceOrder.entity.PensionOrderEntity; ...@@ -14,11 +16,13 @@ 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 io.hmit.modules.serviceOrder.service.PensionOrganizationService;
import io.hmit.service.UserService;
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;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -50,6 +54,9 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -50,6 +54,9 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Autowired @Autowired
private PensionOrganizationService pensionOrganizationService; private PensionOrganizationService pensionOrganizationService;
@Autowired
private UserService userService;
//查询全部订单 //查询全部订单
@Override @Override
public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) { public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) {
...@@ -154,4 +161,44 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -154,4 +161,44 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return getPageData(result, page.getTotal(), PensionOrderDTO.class); return getPageData(result, page.getTotal(), PensionOrderDTO.class);
} }
@Override
public Boolean organizationHandle(Map<String, Object> params, Long userId) {
//userId 可用于校验是否属于本机构的订单,暂未使用
Long orderId = Long.parseLong(params.get("id").toString());
PensionOrderEntity pensionOrderEntity = pensionOrderDao.selectById(orderId);
Integer status = Integer.parseInt(params.get("status").toString());
if (status == 5) {//接单
if (pensionOrderEntity.getStatus() == 0) {
pensionOrderEntity.setStatus(5);
pensionOrderEntity.setStatusName(Constant.OrderStatus.HAND_OUT.getMessage());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
}else {
return false;
}
}else if (status == 1){ //派单
Long recipient_id = Long.parseLong(params.get("recipient_id").toString());
if (pensionOrderEntity.getStatus() == 5) {
pensionOrderEntity.setStatus(1);
pensionOrderEntity.setStatusName(Constant.OrderStatus.ORDER.getMessage());
UserEntity recipient = userService.getUserByUserId(recipient_id);
pensionOrderEntity.setOrderRecipientId(recipient_id);
pensionOrderEntity.setOrderRecipientName(recipient.getUsername());
pensionOrderEntity.setOrderRecipientPhone(recipient.getMobile());
pensionOrderEntity.setOrderRecipientTime(new Date());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
}else {
return false;
}
}else if (status == 3) {
if (pensionOrderEntity.getStatus() != 2 && pensionOrderEntity.getStatus() != 4) {
pensionOrderEntity.setStatus(3);
pensionOrderEntity.setStatusName(Constant.OrderStatus.CANCEL.getMessage());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
} else {
return false;
}
}
return 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