Commit a6006d1e authored by mlchun's avatar mlchun

Merge branch 'master' of 119.3.70.207:xie/pension into Shen

parents e6af3329 f2e7cee7
......@@ -11,6 +11,7 @@ import io.hmit.common.validator.group.AddGroup;
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.PensionDocumentDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
import io.hmit.modules.serviceOrder.service.PensionDocumentService;
......@@ -108,9 +109,11 @@ public class PensionOrderDocumentController {
*/
@PostMapping("/uploadFile")
@ApiOperation("附件上传")
public Result<Map<String, Object>> uploadFile(@RequestParam("file") MultipartFile file,
@RequestParam("orderId") Long orderId){
public Result<Map<String, Object>> uploadFile(@RequestParam("file") MultipartFile file){
Map<String, Object> fileMap = pensionDocumentService.uploadFile(file);
// PensionOrderDocumentDTO dto = new PensionOrderDocumentDTO().assemblePensionOrder(fileMap,orderId,roleId);
/*
if (null != fileMap) {
PensionOrderDocumentDTO dto = new PensionOrderDocumentDTO();
dto.setCreateDate(new Date());
......@@ -122,6 +125,7 @@ public class PensionOrderDocumentController {
} else {
return null;
}
*/
return new Result<Map<String, Object>>().ok(fileMap);
}
}
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);
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.hmit.modules.serviceOrder.service.RoleService;
import io.hmit.modules.serviceOrder.service.RoleUserService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
/**
......@@ -17,6 +22,9 @@ import java.util.Date;
@Data
@ApiModel(value = "订单及相关图片附件关联表")
public class PensionOrderDocumentDTO implements Serializable {
@Autowired
private RoleService roleService;
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
......@@ -34,7 +42,7 @@ public class PensionOrderDocumentDTO implements Serializable {
@ApiModelProperty(value = "文件链接")
private String filePath;
@ApiModelProperty(value = "备注")
@ApiModelProperty(value = "备注 1 服务人员图片;2 服务人员录音; 3 老人/子女评价图片")
private String remark;
@ApiModelProperty(value = "创建者")
......@@ -49,5 +57,30 @@ public class PensionOrderDocumentDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
public PensionOrderDocumentDTO assemblePensionOrder(Map<String, Object> fileMap,Long orderId,Long roleId) {
PensionOrderDocumentDTO dto = new PensionOrderDocumentDTO();
if (null != fileMap) {
dto.setCreateDate(new Date());
dto.setOrderId(orderId);
dto.setDocId(Long.parseLong(fileMap.get("docId").toString()));
dto.setFileName(fileMap.get("fileName").toString());
dto.setFilePath(fileMap.get("filePath").toString());
RoleDTO roleDTO = roleService.get(roleId);
if(roleDTO != null && roleDTO.getName().contains("老人")){
dto.setRemark("3");
}
if(roleDTO != null && roleDTO.getName().contains("服务")){
String fileName = fileMap.get("filePath").toString().toLowerCase();
dto.setRemark("1");
if (fileName.endsWith(".mp3")) {
dto.setRemark("2");
}
}
}
return dto;
}
}
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;
import java.util.List;
/**
* 订单评价表
*
* @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 = "角色id")
private Long roleId;
@ApiModelProperty(value = "好差评 1 好评; 2 中评; 3 差评")
private Integer evaluationReview;
@ApiModelProperty(value = "星级 1-5 分别对应一星---五星")
private String starRating;
@ApiModelProperty(value = "评价内容")
private String content;
@ApiModelProperty(value = "评价文件地址")
private String[] files;
@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
......@@ -3,6 +3,7 @@ package io.hmit.modules.serviceOrder.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import java.util.Map;
......@@ -48,6 +49,12 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询机构订单
PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId);
//老人/子女完成评价
void evaluationDone(PensionOrderEvaluationDTO dto);
//文件保存到数据库
void saveFilesToDB(Long orderId,String files[],Long roleId);
//机构处理订单状态
Boolean organizationHandle(Map<String, Object> params, Long userId);
......
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
......@@ -8,21 +8,16 @@ import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dao.PensionOrderDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderServiceDTO;
import io.hmit.modules.serviceOrder.dto.*;
import io.hmit.modules.serviceOrder.entity.PensionOrderDocumentEntity;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.hmit.modules.serviceOrder.service.PensionOrderServiceService;
import io.hmit.modules.serviceOrder.service.PensionOrganizationService;
import io.hmit.modules.serviceOrder.service.*;
import io.hmit.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 订单表
......@@ -42,6 +37,8 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return wrapper;
}
@Autowired
private RoleService roleService;
@Autowired
private PensionOrderDao pensionOrderDao;
......@@ -49,6 +46,9 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Autowired
private PensionOrderServiceService pensionOrderServiceService;
@Autowired
private PensionOrderDocumentService PensionOrderDocumentService;
@Autowired
private PensionOrganizationService pensionOrganizationService;
......@@ -246,4 +246,45 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return list2;
}
//将文件保存到数据库
@Override
public void saveFilesToDB(Long orderId,String files[],Long roleId){
Arrays.stream(files).forEach(item->{
PensionOrderDocumentDTO orderDocumentDTO = new PensionOrderDocumentDTO();
orderDocumentDTO.setFilePath(item);
orderDocumentDTO.setOrderId(orderId);
orderDocumentDTO.setCreateDate(new Date());
RoleDTO roleDTO = roleService.get(roleId);
if(roleDTO != null && roleDTO.getName().contains("老人")){
orderDocumentDTO.setRemark("3");
}
if(roleDTO != null && roleDTO.getName().contains("服务")){
String fileName = item.toLowerCase();
orderDocumentDTO.setRemark("1");
if (fileName.endsWith(".mp3")) {
orderDocumentDTO.setRemark("2");
}
}
PensionOrderDocumentService.save(orderDocumentDTO);
});
}
@Override
public void evaluationDone(PensionOrderEvaluationDTO dto) {
PensionOrderDTO pensionOrderDTO = get(dto.getOrderId());
if (pensionOrderDTO != null){
pensionOrderDTO.setStatus(Constant.OrderStatus.DONE.geStatus());
pensionOrderDTO.setStatusName(Constant.OrderStatus.DONE.getMessage());
}
update(pensionOrderDTO);
saveFilesToDB(dto.getOrderId(),dto.getFiles(),dto.getRoleId());
}
}
<?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