Commit 61387519 authored by lings's avatar lings

Merge branch 'master' into lings

parents e117429a 3670ce25
...@@ -27,6 +27,7 @@ public class SwaggerConfig { ...@@ -27,6 +27,7 @@ public class SwaggerConfig {
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.host("byyl.zjhmit.com")
.apiInfo(apiInfo()) .apiInfo(apiInfo())
.select() .select()
//加了ApiOperation注解的类,才生成接口文档 //加了ApiOperation注解的类,才生成接口文档
......
...@@ -41,6 +41,7 @@ public class WebMvcConfig implements WebMvcConfigurer { ...@@ -41,6 +41,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/api/**"); registry.addInterceptor(authorizationInterceptor).addPathPatterns("/api/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionorder/**"); registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionorder/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionservicetype/**");
} }
@Override @Override
...@@ -79,4 +80,4 @@ public class WebMvcConfig implements WebMvcConfigurer { ...@@ -79,4 +80,4 @@ public class WebMvcConfig implements WebMvcConfigurer {
converter.setObjectMapper(mapper); converter.setObjectMapper(mapper);
return converter; return converter;
} }
} }
\ No newline at end of file
...@@ -2,12 +2,16 @@ package io.hmit.controller; ...@@ -2,12 +2,16 @@ package io.hmit.controller;
import io.hmit.annotation.Login; import io.hmit.annotation.Login;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.utils.Result; import io.hmit.common.utils.Result;
import io.hmit.common.validator.ValidatorUtils; import io.hmit.common.validator.ValidatorUtils;
import io.hmit.dto.LoginDTO; import io.hmit.dto.LoginDTO;
import io.hmit.dto.UserInfoDTO;
import io.hmit.entity.UserEntity;
import io.hmit.service.TokenService; import io.hmit.service.TokenService;
import io.hmit.service.UserService; import io.hmit.service.UserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -53,4 +57,26 @@ public class ApiLoginController { ...@@ -53,4 +57,26 @@ public class ApiLoginController {
return new Result(); return new Result();
} }
} @Login
\ No newline at end of file @GetMapping("getUserInfoById")
@ApiOperation("根据ID查询用户信息")
@ApiImplicitParam(name = "roleId", value = "用户角色", paramType = "query", dataType = "int")
public Result<UserInfoDTO> getUserInfoById(Long userId) {
UserInfoDTO data = ConvertUtils.sourceToTarget(userService.getUserByUserId(userId),UserInfoDTO.class);
return new Result().ok(data);
}
@Login
@PostMapping("update")
@ApiOperation("修改用户信息")
public Result getUserInfoById(@RequestBody UserInfoDTO userInfoDTO) {
UserEntity userEntity = ConvertUtils.sourceToTarget(userInfoDTO,UserEntity.class);
userService.updateById(userEntity);
return new Result();
}
}
package io.hmit.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@Data
@ApiModel(value = "用户信息")
public class UserInfoDTO {
@ApiModelProperty(value = "用户id")
private Long id;
/**
* 用户名
*/
@ApiModelProperty(value = "用户名")
private String username;
/**
* 手机号
*/
@ApiModelProperty(value = "手机号")
private String mobile;
/**
* 生日
*/
@ApiModelProperty(value = "生日")
private Date birthday;
/**
* 地址_地区
*/
@ApiModelProperty(value = "地址_地区")
private String addressArea;
/**
* 详细地址
*/
@ApiModelProperty(value = "详细地址")
private String address;
}
...@@ -42,4 +42,25 @@ public class UserEntity implements Serializable { ...@@ -42,4 +42,25 @@ public class UserEntity implements Serializable {
*/ */
private Date createDate; private Date createDate;
} /**
\ No newline at end of file * 关联sys_user中的id
*/
private Long userId;
/**
* 微信openid
*/
private String openid;
/**
* 生日
*/
private Date birthday;
/**
* 地址_地区
*/
private String addressArea;
/**
* 详细地址
*/
private String address;
}
...@@ -9,6 +9,7 @@ import io.hmit.common.validator.group.AddGroup; ...@@ -9,6 +9,7 @@ import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup; import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup; import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.NewsDTO; import io.hmit.modules.serviceOrder.dto.NewsDTO;
import io.hmit.modules.serviceOrder.service.NewsDocumentService;
import io.hmit.modules.serviceOrder.service.NewsService; import io.hmit.modules.serviceOrder.service.NewsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -36,6 +38,9 @@ public class NewsController { ...@@ -36,6 +38,9 @@ public class NewsController {
@Autowired @Autowired
private NewsService newsService; private NewsService newsService;
@Autowired
private NewsDocumentService newsDocumentService;
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
...@@ -47,6 +52,12 @@ public class NewsController { ...@@ -47,6 +52,12 @@ public class NewsController {
public Result<PageData<NewsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<NewsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<NewsDTO> page = newsService.page(params); PageData<NewsDTO> page = newsService.page(params);
Map<String, Object> params2 = new HashMap<>();
page.getList().stream().forEach(item ->{
params2.put("newId",item.getId());
item.setNewsDocumentDTOList(newsDocumentService.list(params2));
});
return new Result<PageData<NewsDTO>>().ok(page); return new Result<PageData<NewsDTO>>().ok(page);
} }
...@@ -55,6 +66,10 @@ public class NewsController { ...@@ -55,6 +66,10 @@ public class NewsController {
public Result<NewsDTO> get(@PathVariable("id") Long id){ public Result<NewsDTO> get(@PathVariable("id") Long id){
NewsDTO data = newsService.get(id); NewsDTO data = newsService.get(id);
Map<String, Object> params = new HashMap<>();
params.put("newId",data.getId());
data.setNewsDocumentDTOList(newsDocumentService.list(params));
return new Result<NewsDTO>().ok(data); return new Result<NewsDTO>().ok(data);
} }
......
package io.hmit.modules.serviceOrder.controller; package io.hmit.modules.serviceOrder.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.hmit.common.constant.Constant; import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData; import io.hmit.common.page.PageData;
import io.hmit.common.utils.Result; import io.hmit.common.utils.Result;
...@@ -10,6 +12,7 @@ import io.hmit.common.validator.group.AddGroup; ...@@ -10,6 +12,7 @@ import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup; import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup; import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO; import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.service.PensionServiceService; import io.hmit.modules.serviceOrder.service.PensionServiceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -37,13 +40,16 @@ public class PensionServiceController { ...@@ -37,13 +40,16 @@ public class PensionServiceController {
@Autowired @Autowired
private PensionServiceService pensionServiceService; private PensionServiceService pensionServiceService;
private BaseMapper baseMapper;
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@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 = 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"),
@ApiImplicitParam(name = "serviceTypeId", value = "服务大类ID", paramType = "query", dataType="int")
}) })
public Result<PageData<PensionServiceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<PensionServiceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionServiceDTO> page = pensionServiceService.page(params); PageData<PensionServiceDTO> page = pensionServiceService.page(params);
...@@ -53,16 +59,25 @@ public class PensionServiceController { ...@@ -53,16 +59,25 @@ public class PensionServiceController {
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
//@RequiresPermissions("serviceOrder:pensionservice:info")
public Result<PensionServiceDTO> get(@PathVariable("id") Long id){ public Result<PensionServiceDTO> get(@PathVariable("id") Long id){
PensionServiceDTO data = pensionServiceService.get(id); PensionServiceDTO data = pensionServiceService.get(id);
return new Result<PensionServiceDTO>().ok(data); return new Result<PensionServiceDTO>().ok(data);
} }
@GetMapping("getByServiceTypeId/{serviceTypeId}")
@ApiOperation("根据服务大类获取详情")
public Result<PensionServiceDTO> getByServiceTypeId(@PathVariable("serviceTypeId") Long serviceTypeId){
List<PensionServiceDTO> data = baseMapper.selectList(
new QueryWrapper<PensionServiceDTO>().lambda()
.eq(PensionServiceDTO::getServiceTypeId,serviceTypeId));
return new Result<PensionServiceDTO>().ok(data.get(0));
}
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
//@RequiresPermissions("serviceOrder:pensionservice:save")
public Result save(@RequestBody PensionServiceDTO dto){ public Result save(@RequestBody PensionServiceDTO dto){
//校验数据 //校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
......
package io.hmit.modules.serviceOrder.controller; package io.hmit.modules.serviceOrder.controller;
import com.baomidou.mybatisplus.extension.api.R;
import io.hmit.annotation.Login;
import io.hmit.annotation.LoginUser;
import io.hmit.common.constant.Constant; import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData; import io.hmit.common.page.PageData;
import io.hmit.common.utils.Result; import io.hmit.common.utils.Result;
...@@ -9,6 +12,7 @@ import io.hmit.common.validator.ValidatorUtils; ...@@ -9,6 +12,7 @@ import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup; import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup; import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup; import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO; import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.service.PensionServiceTypeService; import io.hmit.modules.serviceOrder.service.PensionServiceTypeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -51,6 +55,33 @@ public class PensionServiceTypeController { ...@@ -51,6 +55,33 @@ public class PensionServiceTypeController {
return new Result<PageData<PensionServiceTypeDTO>>().ok(page); return new Result<PageData<PensionServiceTypeDTO>>().ok(page);
} }
@GetMapping("list")
@ApiOperation("根据用户角色获取服务列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "roleId", value = "用户角色Id", paramType = "query", dataType="int") ,
@ApiImplicitParam(name = "isFree", value = "是否免费:1 是, 2 否", paramType = "query", dataType="String")
})
public Result<List<PensionServiceTypeDTO>> getServiceList( @ApiIgnore @RequestParam Map<String, Object> params){
List<PensionServiceTypeDTO> list = pensionServiceTypeService.getServiceListByRole(params);
return new Result<List<PensionServiceTypeDTO>>().ok(list);
}
@GetMapping("getAllList")
@ApiOperation("获取所有大类")
@ApiImplicitParams({
@ApiImplicitParam(name = "roleId", value = "用户角色Id", paramType = "query", dataType="int")
})
public Result<List<PensionServiceTypeDTO>> getALlList( @ApiIgnore @RequestParam Map<String, Object> params){
List<PensionServiceTypeDTO> list = pensionServiceTypeService.getALLListByRole(params);
return new Result<List<PensionServiceTypeDTO>>().ok(list);
}
@Login
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
public Result<PensionServiceTypeDTO> get(@PathVariable("id") Long id){ public Result<PensionServiceTypeDTO> get(@PathVariable("id") Long id){
...@@ -92,4 +123,5 @@ public class PensionServiceTypeController { ...@@ -92,4 +123,5 @@ public class PensionServiceTypeController {
return new Result(); return new Result();
} }
} }
...@@ -2,6 +2,7 @@ package io.hmit.modules.serviceOrder.dao; ...@@ -2,6 +2,7 @@ package io.hmit.modules.serviceOrder.dao;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.dao.BaseDao; import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity; import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -14,16 +15,12 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -14,16 +15,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface PensionOrderDao extends BaseDao<PensionOrderEntity> { public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
IPage<PensionOrderEntity> getAllOrderPage(IPage<PensionOrderEntity> page, Long userId); IPage<PensionOrderDTO> getTodayNoProceedOrderPage(IPage<PensionOrderEntity> page);
IPage<PensionOrderEntity> getTodayOrderPage(IPage<PensionOrderEntity> page, Long userId); PensionOrderEntity getOrderInfoByIdAndStatus(Long orderId, Integer status);
IPage<PensionOrderEntity> getOrderPageByStatus(IPage<PensionOrderEntity> page, Long userId, Integer status);
IPage<PensionOrderEntity> getNoProceedOrderPage(IPage<PensionOrderEntity> page);
PensionOrderEntity getOrderInfoByIdAndUserId(Long orderId, Long userId); IPage<PensionOrderDTO> getOrderPageByStatusOrUserId(IPage<PensionOrderEntity> page, Long userId, Integer status);
PensionOrderEntity getOrderInfoByIdAndStatus(Long orderId, Integer status); PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
...@@ -28,6 +29,9 @@ public class NewsDTO implements Serializable { ...@@ -28,6 +29,9 @@ public class NewsDTO implements Serializable {
@ApiModelProperty(value = "内容") @ApiModelProperty(value = "内容")
private String content; private String content;
@ApiModelProperty(value = "附件列表")
private List<NewsDocumentDTO> newsDocumentDTOList;
@ApiModelProperty(value = "发布时间") @ApiModelProperty(value = "发布时间")
private Date pubDate; private Date pubDate;
...@@ -47,4 +51,4 @@ public class NewsDTO implements Serializable { ...@@ -47,4 +51,4 @@ public class NewsDTO implements Serializable {
private Date updateDate; private Date updateDate;
} }
\ No newline at end of file
package io.hmit.modules.serviceOrder.dto; package io.hmit.modules.serviceOrder.dto;
import io.hmit.common.constant.Constant;
import io.hmit.entity.UserEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.UUID;
/** /**
...@@ -64,6 +67,9 @@ public class PensionOrderDTO implements Serializable { ...@@ -64,6 +67,9 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "接单人电话") @ApiModelProperty(value = "接单人电话")
private String orderRecipientPhone; private String orderRecipientPhone;
@ApiModelProperty(value = "实际金额")
private String actPrice;
@ApiModelProperty(value = "部门ID") @ApiModelProperty(value = "部门ID")
private Long deptId; private Long deptId;
...@@ -85,5 +91,26 @@ public class PensionOrderDTO implements Serializable { ...@@ -85,5 +91,26 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
private Date updateDate; private Date updateDate;
@ApiModelProperty(value = "封面")
private String icon;
public PensionOrderDTO assemblePensionOrder(ReservationDTO reservationDTO, UserEntity user){
PensionOrderDTO pensionOrder = new PensionOrderDTO();
pensionOrder.setOrderNum("");
pensionOrder.setStatus(Constant.OrderStatus.BOOKED.geStatus());
pensionOrder.setStatusName(Constant.OrderStatus.BOOKED.getMessage());
pensionOrder.setAddress(reservationDTO.getAddress());
pensionOrder.setServiceId(reservationDTO.getServiceId());
pensionOrder.setServiceName(reservationDTO.getServiceName());
pensionOrder.setRemark(reservationDTO.getRemark());
pensionOrder.setCreator(user.getId());
pensionOrder.setCreatorName(user.getUsername());
pensionOrder.setCreatorTel(user.getMobile());
pensionOrder.setAppointmentPerson(reservationDTO.getAppointmentPerson());
pensionOrder.setAppointmentPhone(reservationDTO.getAppointmentPhone());
pensionOrder.setAppointmentTime(reservationDTO.getAppointmentTime());
return pensionOrder;
}
} }
...@@ -43,5 +43,12 @@ public class PensionOrderServiceDTO implements Serializable { ...@@ -43,5 +43,12 @@ public class PensionOrderServiceDTO implements Serializable {
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
private Date updateDate; private Date updateDate;
public PensionOrderServiceDTO assemblePensionOrderService(PensionOrderDTO pensionOrderDTO){
} PensionOrderServiceDTO dto = new PensionOrderServiceDTO();
\ No newline at end of file dto.setOrderId(pensionOrderDTO.getId());
dto.setServiceId(pensionOrderDTO.getServiceId());
dto.setRemark("");
return dto;
}
}
...@@ -23,7 +23,7 @@ public class PensionServiceDTO implements Serializable { ...@@ -23,7 +23,7 @@ public class PensionServiceDTO implements Serializable {
private Long id; private Long id;
@ApiModelProperty(value = "服务名称") @ApiModelProperty(value = "服务名称")
private String name; private String serviceName;
@ApiModelProperty(value = "服务类型") @ApiModelProperty(value = "服务类型")
private Long serviceTypeId; private Long serviceTypeId;
......
package io.hmit.modules.serviceOrder.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/28
*/
@Data
@ApiModel(value = "老人预约服务")
public class ReservationDTO {
@ApiModelProperty(value = "订单所属的服务id")
private Long serviceId;
@ApiModelProperty(value = "订单所属的服务名称")
private String serviceName;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "预约人")
private String appointmentPerson;
@ApiModelProperty(value = "预约人电话")
private String appointmentPhone;
@ApiModelProperty(value = "预约时间")
private Date appointmentTime;
@ApiModelProperty(value = "备注")
private String remark;
}
...@@ -75,6 +75,10 @@ public class PensionOrderEntity extends BaseEntity { ...@@ -75,6 +75,10 @@ public class PensionOrderEntity extends BaseEntity {
* 接单人电话 * 接单人电话
*/ */
private String orderRecipientPhone; private String orderRecipientPhone;
/**
* 实际金额
*/
private String actPrice;
/** /**
* 部门ID * 部门ID
*/ */
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity; import io.hmit.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.apache.ibatis.annotations.Property;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -23,7 +24,8 @@ public class PensionServiceEntity extends BaseEntity { ...@@ -23,7 +24,8 @@ public class PensionServiceEntity extends BaseEntity {
/** /**
* 服务名称 * 服务名称
*/ */
private String name; // @Property(value = "name")
private String serviceName;
/** /**
* 服务类型 * 服务类型
*/ */
...@@ -36,6 +38,10 @@ public class PensionServiceEntity extends BaseEntity { ...@@ -36,6 +38,10 @@ public class PensionServiceEntity extends BaseEntity {
* 首页图标地址 * 首页图标地址
*/ */
private String icon; private String icon;
/**
* 是否免费
*/
private String isFree;
/** /**
* 详情页大图地址 * 详情页大图地址
*/ */
...@@ -72,4 +78,4 @@ public class PensionServiceEntity extends BaseEntity { ...@@ -72,4 +78,4 @@ public class PensionServiceEntity extends BaseEntity {
* 更新时间 * 更新时间
*/ */
private Date updateDate; private Date updateDate;
} }
\ No newline at end of file
...@@ -19,27 +19,18 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen ...@@ -19,27 +19,18 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId); PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId);
//查询今日订单 //查询今日订单
PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params, Long userId); PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params);
//查询未完成订单 //根据订单Id和订单状态查询 (接单时使用)
PageData<PensionOrderDTO> getIncompleteOrderPage(Map<String, Object> params, Long userId); PensionOrderDTO getOrderInfoByIdAndStatus(Long orderId, Integer status);
//查询已接单订单 //服务订单预约
PageData<PensionOrderDTO> getTakingOrderPage(Map<String, Object> params, Long userId); void reservation(PensionOrderDTO pensionOrderDTO);
//查询已完成订单 //查询已完成订单
PageData<PensionOrderDTO> getFinishedOrderPage(Map<String, Object> params, Long userId); PageData<PensionOrderDTO> getOrderPageByStatus(Map<String, Object> params, Long userId, Integer status);
//查询已取消订单
PageData<PensionOrderDTO> getCanceledOrderPage(Map<String, Object> params, Long userId);
//查询未接单订单
PageData<PensionOrderDTO> getNoProceedOrderPage(Map<String, Object> params);
//查询预约订单详情 //根据用户ID或订单状态查询(带图)
PensionOrderDTO getOrderInfoByIdAndUserId(Long id, Long userId); PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
//根据订单Id和订单状态查询
PensionOrderDTO getOrderInfoByIdAndStatus(Long orderId, Integer status);
} }
\ No newline at end of file
...@@ -4,6 +4,9 @@ import io.hmit.common.service.CrudService; ...@@ -4,6 +4,9 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO; import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity; import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity;
import java.util.List;
import java.util.Map;
/** /**
* 服务种类表 * 服务种类表
* *
...@@ -12,4 +15,7 @@ import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity; ...@@ -12,4 +15,7 @@ import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity;
*/ */
public interface PensionServiceTypeService extends CrudService<PensionServiceTypeEntity, PensionServiceTypeDTO> { public interface PensionServiceTypeService extends CrudService<PensionServiceTypeEntity, PensionServiceTypeDTO> {
} List<PensionServiceTypeDTO> getALLListByRole(Map<String, Object> params);
\ No newline at end of file
List<PensionServiceTypeDTO> getServiceListByRole(Map<String, Object> params);
}
...@@ -8,8 +8,11 @@ import io.hmit.common.service.impl.CrudServiceImpl; ...@@ -8,8 +8,11 @@ import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils; import io.hmit.common.utils.ConvertUtils;
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.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 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;
...@@ -25,11 +28,6 @@ import java.util.Map; ...@@ -25,11 +28,6 @@ import java.util.Map;
@Service @Service
public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, PensionOrderEntity, PensionOrderDTO> implements PensionOrderService { public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, PensionOrderEntity, PensionOrderDTO> implements PensionOrderService {
private static final Integer INCOMPLETE_ORDER = 0;
private static final Integer TAKING_ORDER = 1;
private static final Integer FINISHED_ORDER = 2;
private static final Integer CANCELED_ORDER = 3;
@Override @Override
public QueryWrapper<PensionOrderEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<PensionOrderEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
...@@ -43,74 +41,55 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe ...@@ -43,74 +41,55 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Autowired @Autowired
private PensionOrderDao pensionOrderDao; private PensionOrderDao pensionOrderDao;
@Autowired
private PensionOrderServiceService pensionOrderServiceService;
//查询全部订单
@Override @Override
public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) { public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) {
//分页 //分页
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false); IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderDTO> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatusOrUserId(page, userId, null);
//查询 -- 自定义分页
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getAllOrderPage(page, userId);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params, Long userId) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getTodayOrderPage(page, userId);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class); return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
} }
//查询今日订单
@Override @Override
public PageData<PensionOrderDTO> getIncompleteOrderPage(Map<String, Object> params, Long userId) { public PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false); IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, INCOMPLETE_ORDER); // IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getTodayOrderPage(page, userId); //TODO 今日订单中展示未接单订单
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class); IPage<PensionOrderDTO> pensionOrderDTOIPage = pensionOrderDao.getTodayNoProceedOrderPage(page);
return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class);
} }
//根据订单Id和订单状态查询 (接单时使用)
@Override @Override
public PageData<PensionOrderDTO> getTakingOrderPage(Map<String, Object> params, Long userId) { public PensionOrderDTO getOrderInfoByIdAndStatus(Long id, Integer status) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false); PensionOrderEntity orderEntity = pensionOrderDao.getOrderInfoByIdAndStatus(id, status);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, TAKING_ORDER); return ConvertUtils.sourceToTarget(orderEntity, PensionOrderDTO.class);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
} }
@Override @Override
public PageData<PensionOrderDTO> getFinishedOrderPage(Map<String, Object> params, Long userId) { public void reservation(PensionOrderDTO pensionOrderDTO) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false); save(pensionOrderDTO);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, FINISHED_ORDER); PensionOrderServiceDTO orderServiceDTO = new PensionOrderServiceDTO().assemblePensionOrderService(pensionOrderDTO);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class); pensionOrderServiceService.save(orderServiceDTO);
}
@Override
public PageData<PensionOrderDTO> getCanceledOrderPage(Map<String, Object> params, Long userId) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, CANCELED_ORDER);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
} }
@Override @Override
public PageData<PensionOrderDTO> getNoProceedOrderPage(Map<String, Object> params) { public PageData<PensionOrderDTO> getOrderPageByStatus(Map<String, Object> params, Long userId, Integer status) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false); IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getNoProceedOrderPage(page); IPage<PensionOrderDTO> pensionOrderDTOIPage = pensionOrderDao.getOrderPageByStatusOrUserId(page, userId, status);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class); return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class);
} }
//根据用户ID或订单状态查询(带图)
@Override @Override
public PensionOrderDTO getOrderInfoByIdAndUserId(Long id, Long userId) { public PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status) {
PensionOrderEntity orderEntity = pensionOrderDao.getOrderInfoByIdAndUserId(id, userId); PensionOrderDTO pensionOrderDTO = pensionOrderDao.getOrderInfoByIdAndUserIdOrStatus(orderId, userId, status);
orderEntity.setServiceId(null); return pensionOrderDTO;
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
...@@ -9,6 +9,7 @@ import io.hmit.modules.serviceOrder.service.PensionServiceService; ...@@ -9,6 +9,7 @@ import io.hmit.modules.serviceOrder.service.PensionServiceService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -23,12 +24,17 @@ public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao ...@@ -23,12 +24,17 @@ public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao
@Override @Override
public QueryWrapper<PensionServiceEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<PensionServiceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
String serviceTypeId = params.get("serviceTypeId") ==null?"":params.get("serviceTypeId").toString();
String isFree = (String)params.get("isFree");
QueryWrapper<PensionServiceEntity> wrapper = new QueryWrapper<>(); QueryWrapper<PensionServiceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id); wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(serviceTypeId), "service_type_id", serviceTypeId);
wrapper.eq(StringUtils.isNotBlank(isFree), "is_free", isFree);
return wrapper; return wrapper;
} }
} }
\ No newline at end of file
package io.hmit.modules.serviceOrder.service.impl; package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionServiceDao;
import io.hmit.modules.serviceOrder.dao.PensionServiceTypeDao; import io.hmit.modules.serviceOrder.dao.PensionServiceTypeDao;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO; import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.dto.RoleUserDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity; import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity;
import io.hmit.modules.serviceOrder.service.PensionServiceService;
import io.hmit.modules.serviceOrder.service.PensionServiceTypeService; import io.hmit.modules.serviceOrder.service.PensionServiceTypeService;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import io.hmit.modules.serviceOrder.service.RoleUserService;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 服务种类表 * 服务种类表
...@@ -20,6 +33,21 @@ import java.util.Map; ...@@ -20,6 +33,21 @@ import java.util.Map;
@Service @Service
public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServiceTypeDao, PensionServiceTypeEntity, PensionServiceTypeDTO> implements PensionServiceTypeService { public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServiceTypeDao, PensionServiceTypeEntity, PensionServiceTypeDTO> implements PensionServiceTypeService {
@Autowired
private RoleServiceService roleServiceService;
@Autowired
private PensionServiceService pensionServiceService;
@Autowired
private RoleUserService roleUserService;
@Autowired
private PensionServiceDao pensionServiceDao;
// @Autowired
private BaseMapper baseMapper;
@Override @Override
public QueryWrapper<PensionServiceTypeEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<PensionServiceTypeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
...@@ -31,4 +59,40 @@ public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServic ...@@ -31,4 +59,40 @@ public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServic
} }
} @Override
\ No newline at end of file public List<PensionServiceTypeDTO> getALLListByRole(Map<String, Object> params) {
List<Long> servicesTypeIds = roleServiceService.list(params).stream().map(dto -> dto.getServiceTypeId()).collect(Collectors.toList());
List<PensionServiceTypeDTO> resultList = new ArrayList<>();
for (Long typeId:servicesTypeIds) {
PensionServiceTypeDTO pensionServiceTypeDTO = get(typeId);
resultList.add(pensionServiceTypeDTO);
}
return resultList;
}
@Override
public List<PensionServiceTypeDTO> getServiceListByRole(Map<String, Object> params) {
// List<Long> userRole = roleUserService.list(params).stream().map(dto -> dto.getRoleId()).collect(Collectors.toList());
List<Long> allServicesTypeIds = roleServiceService.list(params).stream().map(dto -> dto.getServiceTypeId()).collect(Collectors.toList());
String isFree = (String)params.get("isFree");
List<PensionServiceEntity> pensionServices = pensionServiceDao.selectList(
new QueryWrapper<PensionServiceEntity>()
.in("service_type_id",allServicesTypeIds)
.eq(StringUtils.isNotBlank(isFree),"is_free",isFree).select("DISTINCT service_type_id"));
// pensionServices.stream().collect(Collectors.groupingBy(PensionServiceEntity::getServiceTypeId))
List<PensionServiceTypeDTO> resultList = new ArrayList<>();
for (PensionServiceEntity pensionService:pensionServices) {
PensionServiceTypeDTO pensionServiceTypeDTO = get(pensionService.getServiceTypeId());
resultList.add(pensionServiceTypeDTO);
}
return resultList;
}
}
...@@ -23,10 +23,11 @@ public class RoleServiceServiceImpl extends CrudServiceImpl<RoleServiceDao, Role ...@@ -23,10 +23,11 @@ public class RoleServiceServiceImpl extends CrudServiceImpl<RoleServiceDao, Role
@Override @Override
public QueryWrapper<RoleServiceEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<RoleServiceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
String o = (String)params.get("id"); String roleId = params.get("roleId") != null ?params.get("roleId").toString():"";
QueryWrapper<RoleServiceEntity> wrapper = new QueryWrapper<>(); QueryWrapper<RoleServiceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id); wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(roleId), "role_id", roleId);
return wrapper; return wrapper;
} }
......
...@@ -23,12 +23,14 @@ public class RoleUserServiceImpl extends CrudServiceImpl<RoleUserDao, RoleUserEn ...@@ -23,12 +23,14 @@ public class RoleUserServiceImpl extends CrudServiceImpl<RoleUserDao, RoleUserEn
@Override @Override
public QueryWrapper<RoleUserEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<RoleUserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
String userId = params.get("userId") != null?params.get("userId").toString():"";
QueryWrapper<RoleUserEntity> wrapper = new QueryWrapper<>(); QueryWrapper<RoleUserEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id); wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(userId), "user_id", userId);
return wrapper; return wrapper;
} }
} }
\ No newline at end of file
...@@ -28,28 +28,56 @@ ...@@ -28,28 +28,56 @@
<result property="updateDate" column="update_date"/> <result property="updateDate" column="update_date"/>
</resultMap> </resultMap>
<select id="getAllOrderPage" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity"> <select id="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE order_recipient_id = #{userId} SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status}
</select>
<select id="getTodayOrderPage" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE TO_DAYS(appointment_time) = TO_DAYS(NOW()) and order_recipient_id = #{userId}
</select>
<select id="getOrderPageByStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.status = #{status} and order_recipient_id = #{userId}
</select> </select>
<select id="getNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity"> <select id="getOrderPageByStatusOrUserId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT * FROM pension_order WHERE pension_order.status = 0 AND order_recipient_id IS NULL 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_phone, po.dept_id, po.creator, po.creator_name,
po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id
<if test="status != null and status == 0">
<if test="userId != null">
and order_recipient_id is null
</if>
and po.status = 0
</if>
<if test="status != null and status != 0">
<if test="userId != null">
and order_recipient_id = #{userId}
</if>
and po.status = #{status}
</if>
<if test="status == null and userId != null">
and order_recipient_id = #{userId}
</if>
</select> </select>
<select id="getOrderInfoByIdAndUserId" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity"> <select id="getOrderInfoByIdAndUserIdOrStatus" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.order_recipient_id = #{userId} 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_phone, po.dept_id, po.creator, po.creator_name,
po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id and po.id = #{orderId}
<if test="userId != null">
and po.order_recipient_id = #{userId}
</if>
<if test="status != null">
and po.status = #{status}
</if>
</select> </select>
<select id="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity"> <select id="getTodayNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status} 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_phone, po.dept_id, po.creator, po.creator_name,
po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id and TO_DAYS(appointment_time) = TO_DAYS(NOW()) and po.status = 0 and order_recipient_id IS NULL
</select> </select>
</mapper> </mapper>
...@@ -5,9 +5,10 @@ ...@@ -5,9 +5,10 @@
<resultMap type="io.hmit.modules.serviceOrder.entity.PensionServiceEntity" id="pensionServiceMap"> <resultMap type="io.hmit.modules.serviceOrder.entity.PensionServiceEntity" id="pensionServiceMap">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="name" column="name"/> <result property="serviceName" column="name"/>
<result property="serviceTypeId" column="service_type_id"/> <result property="serviceTypeId" column="service_type_id"/>
<result property="sort" column="sort"/> <result property="sort" column="sort"/>
<result property="isFree" column="is_free"/>
<result property="icon" column="icon"/> <result property="icon" column="icon"/>
<result property="detailPicture" column="detail_picture"/> <result property="detailPicture" column="detail_picture"/>
<result property="price" column="price"/> <result property="price" column="price"/>
...@@ -23,4 +24,4 @@ ...@@ -23,4 +24,4 @@
</resultMap> </resultMap>
</mapper> </mapper>
\ No newline at end of file
package io.hmit.test;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO;
import io.hmit.modules.serviceOrder.dto.RoleDTO;
import io.hmit.modules.serviceOrder.dto.RoleServiceDTO;
import io.hmit.modules.serviceOrder.service.PensionServiceService;
import io.hmit.modules.serviceOrder.service.PensionServiceTypeService;
import io.hmit.modules.serviceOrder.service.RoleService;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.management.relation.Role;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class TypeServiceTest {
@Autowired
private PensionServiceTypeService pensionServiceTypeService;
@Autowired
private PensionServiceService pensionServiceService;
@Autowired
private RoleServiceService roleServiceService;
@Autowired
private RoleService roleService;
@Test
public void test(){
System.out.println("hello world!!");
}
@Test
public void getList(){
List<Long> roleIds = new ArrayList<>();
roleIds.add(1354991196866453506L);
roleIds.add(1354991197348798465L);
Map<String, Object> params = new HashMap<>();
List<Long> servicesTypeIds =pensionServiceTypeService.list(params).stream().map(PensionServiceTypeDTO::getId).collect(Collectors.toList());
roleIds.forEach(roleId -> {
for (Long typeId:servicesTypeIds){
RoleServiceDTO roleServiceDTO = new RoleServiceDTO();
roleServiceDTO.setRoleId(roleId);
roleServiceDTO.setServiceTypeId(typeId);
roleServiceService.save(roleServiceDTO);
}
});
}
@Test
public void updateTime(){
Map<String, Object> params = new HashMap<>();
List<PensionServiceDTO> pensionServiceDTOS =pensionServiceService.list(params);
pensionServiceDTOS.stream().forEach(item ->{
item.setServiceTime("周一 ~ 周日 09:00-18:00");
item.setTimesNum(18);
item.setRemark("为老人提供免费的"+item.getServiceName()+"服务");
pensionServiceService.update(item);
});
}
@Test
public void saveServiceType(){
List<String> names = new ArrayList<>();
names.add("健康检查");
names.add("家政服务");
names.add("心理慰藉");
names.add("理发");
names.add("送药上门");
names.add("健康养生");
names.add("临终关怀");
names.forEach(name ->{
PensionServiceTypeDTO pensionServiceTypeDTO = new PensionServiceTypeDTO();
pensionServiceTypeDTO.setName(name);
pensionServiceTypeDTO.setSort(1);
pensionServiceTypeDTO.setIcon("");
pensionServiceTypeDTO.setRemark("");
pensionServiceTypeService.save(pensionServiceTypeDTO);
});
}
}
...@@ -178,4 +178,43 @@ public interface Constant { ...@@ -178,4 +178,43 @@ public interface Constant {
return value; return value;
} }
} }
} /**
\ No newline at end of file * 订单状态
*/
enum OrderStatus{
/**
* 未接单/已预约
*/
BOOKED(0,"未接单"),
/**
* 已接单
*/
ORDER(1,"已接单"),
/**
* 已完成
*/
DONE(2,"已完成"),
/**
* 已取消
*/
CANCEL(3,"已取消");
private int status;
private String message;
OrderStatus(int status,String message){
this.status = status;
this.message = message;
}
public int geStatus(){
return status;
}
public String getMessage() {
return message;
}
}
}
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