perf: 添加功能
This commit is contained in:
parent
808efac0bc
commit
67b140318e
|
|
@ -48,6 +48,9 @@ public class TiketController extends ControllerBase {
|
||||||
@Resource
|
@Resource
|
||||||
private IAppUserService appUserService;
|
private IAppUserService appUserService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITicketEvaluateService ticketEvaluateService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索设备
|
* 搜索设备
|
||||||
*
|
*
|
||||||
|
|
@ -171,4 +174,15 @@ public class TiketController extends ControllerBase {
|
||||||
ticketService.revoked(id);
|
ticketService.revoked(id);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加工单评价
|
||||||
|
*
|
||||||
|
* @param request 请求信息
|
||||||
|
**/
|
||||||
|
@PostMapping("addTicketEvaluate")
|
||||||
|
public ApiResult<Void> addTicketEvaluate(@Valid @RequestBody TicketEvaluateAddRequest request) {
|
||||||
|
ticketEvaluateService.add(request);
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.nflg.mobilebroken.common.pojo.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TicketEvaluateAddRequest {
|
||||||
|
|
||||||
|
//工单id
|
||||||
|
@NotNull
|
||||||
|
private Integer ticketId;
|
||||||
|
|
||||||
|
//服务评价
|
||||||
|
@NotBlank
|
||||||
|
private String serviceEvaluation;
|
||||||
|
|
||||||
|
//服务评价选择
|
||||||
|
private List<String> serviceEvaluationSelect;
|
||||||
|
|
||||||
|
//产品评价
|
||||||
|
@NotBlank
|
||||||
|
private String productEvaluation;
|
||||||
|
|
||||||
|
//产品评价选择
|
||||||
|
private List<String> productEvaluationSelect;
|
||||||
|
|
||||||
|
//评分
|
||||||
|
private BigDecimal score;
|
||||||
|
|
||||||
|
//反馈
|
||||||
|
private String feedback;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.nflg.mobilebroken.repository.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 代码生成器生成
|
||||||
|
* @since 2025
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("ticket_evaluate")
|
||||||
|
public class TicketEvaluate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单id
|
||||||
|
*/
|
||||||
|
private Integer ticketId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 售后服务评价
|
||||||
|
*/
|
||||||
|
private String serviceEvaluation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 售后服务评价选择
|
||||||
|
*/
|
||||||
|
private String serviceEvaluationSelect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品体验评价
|
||||||
|
*/
|
||||||
|
private String productEvaluation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品体验评价选择
|
||||||
|
*/
|
||||||
|
private String productEvaluationSelect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评分
|
||||||
|
*/
|
||||||
|
private BigDecimal score;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 反馈
|
||||||
|
*/
|
||||||
|
private String feedback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.nflg.mobilebroken.repository.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.nflg.mobilebroken.repository.entity.TicketEvaluate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 代码生成器生成
|
||||||
|
* @since 2025
|
||||||
|
*/
|
||||||
|
public interface TicketEvaluateMapper extends BaseMapper<TicketEvaluate> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.nflg.mobilebroken.repository.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.request.TicketEvaluateAddRequest;
|
||||||
|
import com.nflg.mobilebroken.repository.entity.TicketEvaluate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 代码生成器生成
|
||||||
|
* @since 2025
|
||||||
|
*/
|
||||||
|
public interface ITicketEvaluateService extends IService<TicketEvaluate> {
|
||||||
|
|
||||||
|
void add(TicketEvaluateAddRequest request);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.nflg.mobilebroken.repository.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.nflg.mobilebroken.common.constant.TicketState;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.request.TicketEvaluateAddRequest;
|
||||||
|
import com.nflg.mobilebroken.common.util.VUtils;
|
||||||
|
import com.nflg.mobilebroken.repository.entity.Ticket;
|
||||||
|
import com.nflg.mobilebroken.repository.entity.TicketEvaluate;
|
||||||
|
import com.nflg.mobilebroken.repository.mapper.TicketEvaluateMapper;
|
||||||
|
import com.nflg.mobilebroken.repository.service.ITicketEvaluateService;
|
||||||
|
import com.nflg.mobilebroken.repository.service.ITicketService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 代码生成器生成
|
||||||
|
* @since 2025
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TicketEvaluateServiceImpl extends ServiceImpl<TicketEvaluateMapper, TicketEvaluate> implements ITicketEvaluateService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITicketService ticketService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add(TicketEvaluateAddRequest request) {
|
||||||
|
Ticket ticket = ticketService.getById(request.getTicketId());
|
||||||
|
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
|
||||||
|
VUtils.trueThrowBusinessError(!Objects.equals(ticket.getState(), TicketState.ProcessingCompleted.getState())
|
||||||
|
&& !Objects.equals(ticket.getState(), TicketState.Closed.getState())).throwMessage("工单状态异常");
|
||||||
|
TicketEvaluate ticketEvaluate = new TicketEvaluate()
|
||||||
|
.setTicketId(request.getTicketId())
|
||||||
|
.setServiceEvaluation(request.getServiceEvaluation())
|
||||||
|
.setServiceEvaluationSelect(StrUtil.join(",", request.getServiceEvaluationSelect()))
|
||||||
|
.setProductEvaluation(request.getProductEvaluation())
|
||||||
|
.setProductEvaluationSelect(StrUtil.join(",", request.getProductEvaluationSelect()))
|
||||||
|
.setScore(request.getScore())
|
||||||
|
.setFeedback(request.getFeedback())
|
||||||
|
.setCreateTime(LocalDateTime.now());
|
||||||
|
save(ticketEvaluate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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="com.nflg.mobilebroken.repository.mapper.TicketEvaluateMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue