Commit eed265fb authored by mengmeng's avatar mengmeng

老人子女已完成接口

parent 13445401
package io.hmit.modules.serviceOrder.controller;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO;
import io.hmit.modules.serviceOrder.service.PensionOrderEvaluationService;
import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
* 订单评价表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@RestController
@RequestMapping("serviceOrder/pensionorderevaluation")
@Api(tags="订单评价表")
public class PensionOrderEvaluationController {
@Autowired
private PensionOrderEvaluationService pensionOrderEvaluationService;
@Autowired
private PensionOrderService pensionOrderService;
@GetMapping("page")
@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<PensionOrderEvaluationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionOrderEvaluationDTO> page = pensionOrderEvaluationService.page(params);
return new Result<PageData<PensionOrderEvaluationDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<PensionOrderEvaluationDTO> get(@PathVariable("id") Long id){
PensionOrderEvaluationDTO data = pensionOrderEvaluationService.get(id);
return new Result<PensionOrderEvaluationDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
public Result save(@RequestBody PensionOrderEvaluationDTO dto){
pensionOrderEvaluationService.save(dto);
pensionOrderService.evaluationDone(dto.getOrderId());
return new Result();
}
@PutMapping
@ApiOperation("修改")
public Result update(@RequestBody PensionOrderEvaluationDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
pensionOrderEvaluationService.update(dto);
return new Result();
}
}
package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.PensionOrderEvaluationEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 订单评价表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Mapper
public interface PensionOrderEvaluationDao extends BaseDao<PensionOrderEvaluationEntity> {
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单评价表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Data
@ApiModel(value = "订单评价表")
public class PensionOrderEvaluationDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "订单所属的服务id")
private Long orderId;
@ApiModelProperty(value = "好差评 1 好评; 2 中评; 3 差评")
private Integer evaluationReview;
@ApiModelProperty(value = "星级 1-5 分别对应一星---五星")
private String starRating;
@ApiModelProperty(value = "评价内容")
private String content;
@ApiModelProperty(value = "评价文件地址")
private String file;
@ApiModelProperty(value = "创建者")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
}
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 订单评价表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pension_order_evaluation")
public class PensionOrderEvaluationEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* 好差评 1 好评; 2 中评; 3 差评
*/
private Integer evaluationReview;
/**
* 星级 1-5 分别对应一星---五星
*/
private String starRating;
/**
* 评价内容
*/
private String content;
/**
* 评价文件地址
*/
private String file;
}
package io.hmit.modules.serviceOrder.service;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEvaluationEntity;
/**
* 订单评价表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
public interface PensionOrderEvaluationService extends CrudService<PensionOrderEvaluationEntity, PensionOrderEvaluationDTO> {
}
\ No newline at end of file
......@@ -47,4 +47,7 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询机构订单
PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId);
//老人/子女完成评价
void evaluationDone(Long orderId);
}
package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionOrderEvaluationDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEvaluationEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderEvaluationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 订单评价表
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-03-11
*/
@Service
public class PensionOrderEvaluationServiceImpl extends CrudServiceImpl<PensionOrderEvaluationDao, PensionOrderEvaluationEntity, PensionOrderEvaluationDTO> implements PensionOrderEvaluationService {
@Override
public QueryWrapper<PensionOrderEvaluationEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<PensionOrderEvaluationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}
\ No newline at end of file
......@@ -154,4 +154,14 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return getPageData(result, page.getTotal(), PensionOrderDTO.class);
}
@Override
public void evaluationDone(Long orderId) {
PensionOrderDTO dto = get(orderId);
if (dto != null){
dto.setStatus(Constant.OrderStatus.DONE.geStatus());
dto.setStatusName(Constant.OrderStatus.DONE.getMessage());
}
update(dto);
}
}
<?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.PensionOrderEvaluationDao">
<resultMap type="io.hmit.modules.serviceOrder.entity.PensionOrderEvaluationEntity" id="pensionOrderEvaluationMap">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="evaluationReview" column="evaluation_review"/>
<result property="starRating" column="star_rating"/>
<result property="content" column="content"/>
<result property="file" column="file"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
</resultMap>
</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