添加讲师评价机构评价的APP接口

This commit is contained in:
wans 2021-06-20 16:34:14 +08:00
parent d5d64597b5
commit e8993f8306
8 changed files with 431 additions and 13 deletions

View File

@ -0,0 +1,82 @@
package cn.com.tenlion.controller.app.api.appraise;
import cn.com.tenlion.dao.appraise.IAppraiseDao;
import cn.com.tenlion.pojo.dtos.appraise.OrgAppraiseDTO;
import cn.com.tenlion.pojo.dtos.appraise.TeacherAppraiseDTO;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.exceptions.SaveException;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.util.map.HashMapUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 培训机构评价
* @author xwangs
* @create 2021-06-20 14:34
* @description
*/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "培训机构评价")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/org-appraise")
public class OrgAppraiseAppController extends DefaultBaseController {
@Autowired
private IAppraiseDao appraiseDao;
@ApiOperation(value = "保存培训机构评价", notes = "保存培训机构评价")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save-org-appraise")
public SuccessResult saveOrgAppraise(@RequestHeader("token") String token,
@RequestBody OrgAppraiseDTO orgAppraiseDTO) throws SaveException {
Map<String, Object> params = HashMapUtil.beanToMap(orgAppraiseDTO);
appraiseDao.saveOrgAppraise(params);
return new SuccessResult();
}
@ApiOperation(value = "用户查询培训机构评价结果", notes = "查询个人资料信息接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-org-appraise")
public OrgAppraiseDTO getOrgAppraise(@RequestHeader("token") String token) {
Map<String, Object> params = requestParams();
OrgAppraiseDTO dto = appraiseDao.getOrgAppraise(params);
return dto == null ? new OrgAppraiseDTO() : dto;
}
@ApiOperation(value = "保存讲师评价", notes = "保存讲师评价")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save-teacher-appraise")
public SuccessResult saveTeacherAppraise(@RequestHeader("token") String token,
@RequestBody TeacherAppraiseDTO teacherAppraiseDTO) throws SaveException {
Map<String, Object> params = HashMapUtil.beanToMap(teacherAppraiseDTO);
appraiseDao.saveTeacherAppraise(params);
return new SuccessResult();
}
@ApiOperation(value = "用户查询讲师评价结果", notes = "查询个人资料信息接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-teacher-appraise")
public TeacherAppraiseDTO getTeacherAppraise(@RequestHeader("token") String token) {
Map<String, Object> params = requestParams();
TeacherAppraiseDTO dto = appraiseDao.getTeacherAppraise(params);
return dto == null ? new TeacherAppraiseDTO() : dto;
}
}

View File

@ -0,0 +1,43 @@
package cn.com.tenlion.dao.appraise;
import cn.com.tenlion.pojo.dtos.appraise.OrgAppraiseDTO;
import cn.com.tenlion.pojo.dtos.appraise.TeacherAppraiseDTO;
import org.springframework.stereotype.Repository;
import java.util.Map;
/**
* 机构评价讲师评价Dao
* @author xwangs
* @create 2021-06-20 14:58
* @description
*/
@Repository
public interface IAppraiseDao {
/**
* 保存机构评价
* @param params
*/
void saveOrgAppraise(Map<String, Object> params);
/**
* 用户查询培训机构评价
* @param params
* @return
*/
OrgAppraiseDTO getOrgAppraise(Map<String, Object> params);
/**
* 保存讲师评价
* @param params
*/
void saveTeacherAppraise(Map<String, Object> params);
/**
* 用户查询讲师评价
* @param params
* @return
*/
TeacherAppraiseDTO getTeacherAppraise(Map<String, Object> params);
}

View File

@ -1,13 +1,12 @@
package cn.com.tenlion.dao.classplan; package cn.com.tenlion.dao.classplan;
import cn.com.tenlion.pojo.dtos.applystudentsnew.ApplyStudentsNewDTO; import cn.com.tenlion.pojo.bos.classplan.ClassPlanBO;
import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO;
import cn.com.tenlion.pojo.pos.classplan.ClassPlanPO;
import ink.wgink.exceptions.RemoveException; import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException; import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException; import ink.wgink.exceptions.SearchException;
import ink.wgink.exceptions.UpdateException; import ink.wgink.exceptions.UpdateException;
import cn.com.tenlion.pojo.bos.classplan.ClassPlanBO;
import cn.com.tenlion.pojo.pos.classplan.ClassPlanPO;
import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@ -169,4 +168,10 @@ public interface IClassPlanDao {
*/ */
void updateExamFile(Map<String, Object> params); void updateExamFile(Map<String, Object> params);
/**
* 查询开设工种的所有培训机构
* @param params
* @return
*/
List<Map<String, Object>> listOrgSignInfo(Map<String, Object> params);
} }

View File

@ -0,0 +1,94 @@
package cn.com.tenlion.pojo.dtos.appraise;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 机构评价实体类
* @author xwangs
* @create 2021-06-20 14:46
* @description
*/
@ApiModel
public class OrgAppraiseDTO {
@ApiModelProperty(name = "orgId", value = "机构ID")
private String orgId;
@ApiModelProperty(name = "appraiseLevel", value = "评价等级1-5默认0")
private String appraiseLevel;
@ApiModelProperty(name = "classPlanId", value = "培训计划ID")
private String classPlanId;
@ApiModelProperty(name = "fullName", value = "评价人")
private String fullName;
@ApiModelProperty(name = "bindUserAccount", value = "统一用户Id")
private String bindUserAccount;
@ApiModelProperty(name = "appraiseGMT", value = "评价时间")
private String appraiseGMT;
public String getOrgId() {
return orgId == null ? "" : orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getAppraiseLevel() {
return appraiseLevel == null ? "" : appraiseLevel;
}
public void setAppraiseLevel(String appraiseLevel) {
this.appraiseLevel = appraiseLevel;
}
public String getClassPlanId() {
return classPlanId == null ? "" : classPlanId;
}
public void setClassPlanId(String classPlanId) {
this.classPlanId = classPlanId;
}
public String getFullName() {
return fullName == null ? "" : fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getBindUserAccount() {
return bindUserAccount == null ? "" : bindUserAccount;
}
public void setBindUserAccount(String bindUserAccount) {
this.bindUserAccount = bindUserAccount;
}
public String getAppraiseGMT() {
return appraiseGMT == null ? "" : appraiseGMT;
}
public void setAppraiseGMT(String appraiseGMT) {
this.appraiseGMT = appraiseGMT;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"orgId\":\"")
.append(orgId).append('\"');
sb.append(",\"appraiseLevel\":\"")
.append(appraiseLevel).append('\"');
sb.append(",\"classPlanId\":\"")
.append(classPlanId).append('\"');
sb.append(",\"fullName\":\"")
.append(fullName).append('\"');
sb.append(",\"bindUserAccount\":\"")
.append(bindUserAccount).append('\"');
sb.append(",\"appraiseGMT\":\"")
.append(appraiseGMT).append('\"');
sb.append('}');
return sb.toString();
}
}

View File

@ -0,0 +1,94 @@
package cn.com.tenlion.pojo.dtos.appraise;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 讲师评价实体类
* @author xwangs
* @create 2021-06-20 14:46
* @description
*/
@ApiModel
public class TeacherAppraiseDTO {
@ApiModelProperty(name = "teacherId", value = "机构ID")
private String teacherId;
@ApiModelProperty(name = "appraiseLevel", value = "评价等级1-5默认0")
private String appraiseLevel;
@ApiModelProperty(name = "classPlanId", value = "培训计划ID")
private String classPlanId;
@ApiModelProperty(name = "fullName", value = "评价人")
private String fullName;
@ApiModelProperty(name = "bindUserAccount", value = "统一用户Id")
private String bindUserAccount;
@ApiModelProperty(name = "appraiseGMT", value = "评价时间")
private String appraiseGMT;
public String getTeacherId() {
return teacherId == null ? "" : teacherId;
}
public void setTeacherId(String teacherId) {
this.teacherId = teacherId;
}
public String getAppraiseLevel() {
return appraiseLevel == null ? "" : appraiseLevel;
}
public void setAppraiseLevel(String appraiseLevel) {
this.appraiseLevel = appraiseLevel;
}
public String getClassPlanId() {
return classPlanId == null ? "" : classPlanId;
}
public void setClassPlanId(String classPlanId) {
this.classPlanId = classPlanId;
}
public String getFullName() {
return fullName == null ? "" : fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getBindUserAccount() {
return bindUserAccount == null ? "" : bindUserAccount;
}
public void setBindUserAccount(String bindUserAccount) {
this.bindUserAccount = bindUserAccount;
}
public String getAppraiseGMT() {
return appraiseGMT == null ? "" : appraiseGMT;
}
public void setAppraiseGMT(String appraiseGMT) {
this.appraiseGMT = appraiseGMT;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"teacherId\":\"")
.append(teacherId).append('\"');
sb.append(",\"appraiseLevel\":\"")
.append(appraiseLevel).append('\"');
sb.append(",\"classPlanId\":\"")
.append(classPlanId).append('\"');
sb.append(",\"fullName\":\"")
.append(fullName).append('\"');
sb.append(",\"bindUserAccount\":\"")
.append(bindUserAccount).append('\"');
sb.append(",\"appraiseGMT\":\"")
.append(appraiseGMT).append('\"');
sb.append('}');
return sb.toString();
}
}

View File

@ -633,26 +633,28 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl
if("0".equals(workerCatalog)){ if("0".equals(workerCatalog)){
return new SuccessResultList<>(new ArrayList<>(),0,0L); return new SuccessResultList<>(new ArrayList<>(),0,0L);
} }
// 查询开设当前工种的所有培训机构
Map<String, Object> query = new HashMap<>(); Map<String, Object> query = new HashMap<>();
query.put("institutionType","training"); query.put("workTypeId",workerCatalog);
List<InstitutionDTO> list = iInstitutionService.list(query); List<Map<String, Object>> orgList = classPlanDao.listOrgSignInfo(query);
List<Map<String,Object>> res = new ArrayList<>(); List<Map<String,Object>> res = new ArrayList<>();
if(list != null && list.size() > 0){ if(orgList != null && orgList.size() > 0){
for (InstitutionDTO item :list){ for (Map<String, Object> item :orgList){
// 查询开班情况 // 查询开班情况
query.put("workTypeId", workerCatalog); query.put("orgId", item.get("orgId"));
query.put("orgId", item.getInstitutionId()); InstitutionDTO institutionDTO = iInstitutionService.get(item.get("orgId").toString());
ExamCheckDTO examCheck = examCheckDao.getExamCheck(query); ExamCheckDTO examCheck = examCheckDao.getExamCheck(query);
if(null == examCheck){ if(null == examCheck){
//查不到 //查不到
Map<String, Object> itemMap = new HashMap<>(); Map<String, Object> itemMap = new HashMap<>();
itemMap.put("orgId",item.getInstitutionId()); itemMap.put("orgId",institutionDTO.getInstitutionId());
itemMap.put("orgName",item.getInstitutionName()); itemMap.put("orgName",institutionDTO.getInstitutionName());
//当前报名多少人 //当前报名多少人
query.clear(); query.clear();
query.put("applyInstitutionId",item.getInstitutionId()); query.put("applyInstitutionId",institutionDTO.getInstitutionId());
query.put("applyWorkTypeId",workerCatalog); query.put("applyWorkTypeId",workerCatalog);
List<String> applyAuditStates = new ArrayList<>(); List<String> applyAuditStates = new ArrayList<>();
applyAuditStates.add("0");
applyAuditStates.add("2"); applyAuditStates.add("2");
query.put("applyAuditStates",applyAuditStates); query.put("applyAuditStates",applyAuditStates);
List<ApplyDTO> passUserList = applyService.list(query); List<ApplyDTO> passUserList = applyService.list(query);

View File

@ -0,0 +1,85 @@
<?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="cn.com.tenlion.dao.appraise.IAppraiseDao">
<resultMap id="orgAppraiseDTO" type="cn.com.tenlion.pojo.dtos.appraise.OrgAppraiseDTO">
<result column="org_id" property="orgId"/>
<result column="appraise_level" property="appraiseLevel"/>
<result column="class_plan_id" property="classPlanId"/>
<result column="full_name" property="fullName"/>
<result column="bind_user_account" property="bindUserAccount"/>
<result column="appraise_gmt" property="appraiseGMT"/>
</resultMap>
<resultMap id="teacherAppraiseDTO" type="cn.com.tenlion.pojo.dtos.appraise.TeacherAppraiseDTO">
<result column="teacher_id" property="teacherId"/>
<result column="appraise_level" property="appraiseLevel"/>
<result column="class_plan_id" property="classPlanId"/>
<result column="full_name" property="fullName"/>
<result column="bind_user_account" property="bindUserAccount"/>
<result column="appraise_gmt" property="appraiseGMT"/>
</resultMap>
<insert id="saveOrgAppraise" parameterType="map">
INSERT INTO e_org_appraise
(org_id, appraise_level, class_plan_id, full_name, bind_user_account, appraise_gmt, is_delete)
VALUES
(#{orgId}, #{appraiseLevel}, #{classPlanId}, #{fullName}, #{bindUserAccount}, #{appraiseGMT}, '0')
</insert>
<select id="getOrgAppraise" parameterType="map" resultMap="orgAppraiseDTO">
SELECT
t1.org_id,
t1.appraise_level,
t1.class_plan_id,
t1.full_name,
t1.bind_user_account,
t1.appraise_gmt
FROM
e_org_appraise t1
WHERE
t1.is_delete = '0'
<if test="orgId !=null and orgId !=''">
AND t1.org_id = #{orgId}
</if>
<if test="classPlanId !=null and classPlanId !=''">
AND t1.class_plan_id = #{classPlanId}
</if>
<if test="bindUserAccount !=null and bindUserAccount !=''">
AND t1.bind_user_account = #{bindUserAccount}
</if>
limit 1
</select>
<insert id="saveTeacherAppraise" parameterType="map">
INSERT INTO e_teacher_appraise
(teacher_id, appraise_level, class_plan_id, full_name, bind_user_account, appraise_gmt, is_delete)
VALUES
(#{teacherId}, #{appraiseLevel}, #{classPlanId}, #{fullName}, #{bindUserAccount}, #{appraiseGMT}, '0')
</insert>
<select id="getTeacherAppraise" parameterType="map" resultMap="teacherAppraiseDTO">
SELECT
t1.teacher_id,
t1.appraise_level,
t1.class_plan_id,
t1.full_name,
t1.bind_user_account,
t1.appraise_gmt
FROM
e_teacher_appraise t1
WHERE
t1.is_delete = '0'
<if test="teacherId !=null and teacherId !=''">
AND t1.teacher_id = #{teacherId}
</if>
<if test="classPlanId !=null and classPlanId !=''">
AND t1.class_plan_id = #{classPlanId}
</if>
<if test="bindUserAccount !=null and bindUserAccount !=''">
AND t1.bind_user_account = #{bindUserAccount}
</if>
limit 1
</select>
</mapper>

View File

@ -525,4 +525,17 @@
class_plan_id = #{classPlanId} class_plan_id = #{classPlanId}
</update> </update>
<!-- 查询开设工种下所有机构列表-->
<select id="listOrgSignInfo" parameterType="map" resultType="map">
SELECT
institution_id orgId
FROM
e_training_institution_work_type
WHERE
is_delete = '0'
AND work_type_id = #{workTypeId}
GROUP BY
institution_id
</select>
</mapper> </mapper>