教师招募

main
tamguo 7 years ago
parent 5ab44111fc
commit bd56c1c79b

@ -0,0 +1,8 @@
package com.tamguo.modules.sys.dao;
import com.tamguo.config.dao.SuperMapper;
import com.tamguo.modules.sys.model.TeacherEntity;
public interface TeacherMapper extends SuperMapper<TeacherEntity>{
}

@ -0,0 +1,164 @@
package com.tamguo.modules.sys.model;
import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.config.dao.SuperEntity;
import com.tamguo.modules.sys.model.enums.TeacherStatus;
/**
* The persistent class for the tiku_teacher database table.
*
*/
@TableName(value="tiku_teacher")
public class TeacherEntity extends SuperEntity<TeacherEntity> implements Serializable {
private static final long serialVersionUID = 1L;
private String mobile;
private String email;
private String name;
private String motto;
private String provinceId;
private String cityId;
private String subjectId;
private String courseId;
private String cardId;
private String cardPhoto;
private String occupationPapers;
private Long createTime;
@JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString)
private TeacherStatus status;
private String qq;
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMotto() {
return motto;
}
public void setMotto(String motto) {
this.motto = motto;
}
public String getCourseId() {
return courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getCardId() {
return cardId;
}
public void setCardId(String cardId) {
this.cardId = cardId;
}
public String getCardPhoto() {
return cardPhoto;
}
public void setCardPhoto(String cardPhoto) {
this.cardPhoto = cardPhoto;
}
public String getOccupationPapers() {
return occupationPapers;
}
public void setOccupationPapers(String occupationPapers) {
this.occupationPapers = occupationPapers;
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getSubjectId() {
return subjectId;
}
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
}
public String getProvinceId() {
return provinceId;
}
public void setProvinceId(String provinceId) {
this.provinceId = provinceId;
}
public String getCityId() {
return cityId;
}
public void setCityId(String cityId) {
this.cityId = cityId;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public TeacherStatus getStatus() {
return status;
}
public void setStatus(TeacherStatus status) {
this.status = status;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}

@ -0,0 +1,32 @@
package com.tamguo.modules.sys.model.enums;
import java.io.Serializable;
public enum TeacherStatus {
APPLY("apply", "申请"),
PASS("pass", "通过"),
UNPASS("unpass", "不通过");
private String value;
private String desc;
TeacherStatus(final String value, final String desc) {
this.value = value;
this.desc = desc;
}
public Serializable getValue() {
return this.value;
}
public String getDesc(){
return this.desc;
}
@Override
public String toString() {
return this.value;
}
}

@ -0,0 +1,23 @@
package com.tamguo.modules.sys.service;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.sys.model.TeacherEntity;
public interface ITeacherService {
/**
*
* @param mobile
* @param verifyCode
* @return
*/
Result getTeacherByMobile(String mobile , String verifyCode);
/**
*
* @param teacher
* @return
*/
void joinus(TeacherEntity teacher);
}

@ -0,0 +1,52 @@
package com.tamguo.modules.sys.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.common.utils.DateUtil;
import com.tamguo.common.utils.Result;
import com.tamguo.common.utils.SystemConstant;
import com.tamguo.config.redis.CacheService;
import com.tamguo.modules.sys.dao.TeacherMapper;
import com.tamguo.modules.sys.model.TeacherEntity;
import com.tamguo.modules.sys.model.enums.TeacherStatus;
import com.tamguo.modules.sys.service.ITeacherService;
@Service
public class TeacherService extends ServiceImpl<TeacherMapper, TeacherEntity> implements ITeacherService {
@Autowired
TeacherMapper teacherMapper;
@Autowired
CacheService cacheService;
@Transactional(readOnly=false)
@Override
public Result getTeacherByMobile(String mobile, String verifyCode) {
// 校验短信验证码
if(!cacheService.isExist(SystemConstant.ALIYUN_MOBILE_SMS_PREFIX + mobile)){
return Result.result(201, null, "请发送验证码");
}
if(!((String)cacheService.getObject(SystemConstant.ALIYUN_MOBILE_SMS_PREFIX + mobile)).equals(verifyCode)) {
return Result.result(202, null, "验证码错误");
}
TeacherEntity condition = new TeacherEntity();
condition.setMobile(mobile);
TeacherEntity teacher = teacherMapper.selectOne(condition);
if(teacher == null) {
return Result.result(203, null, "欢迎");
}
return Result.successResult(teacher);
}
@Transactional(readOnly=false)
@Override
public void joinus(TeacherEntity teacher) {
teacher.setCreateTime(DateUtil.getTime());
teacher.setStatus(TeacherStatus.APPLY);
teacherMapper.insert(teacher);
}
}

@ -156,7 +156,7 @@
</dependencyManagement>
<build>
<finalName>tamguo-tms</finalName>
<finalName>tms</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>

@ -20,6 +20,7 @@ public class ThymeleafConfig implements EnvironmentAware{
if(viewResolver != null) {
Map<String, Object> vars = new HashMap<>();
vars.put("domainName", env.getProperty("domain.name"));
vars.put("adminDomain", env.getProperty("admin.domain.name"));
vars.put("PAPER_TYPE_ZHENTI", "1");
vars.put("PAPER_TYPE_MONI", "2");
vars.put("PAPER_TYPE_YATI", "3");

@ -0,0 +1,45 @@
package com.tamguo.web.sys;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.sys.model.TeacherEntity;
import com.tamguo.modules.sys.service.ITeacherService;
@Controller
public class JoinusController {
@Autowired
private ITeacherService iTeacherService;
@RequestMapping(value = "teacher/joinus.html", method = RequestMethod.GET)
public ModelAndView register(ModelAndView model , HttpSession session) {
model.setViewName("teacher/joinus");
return model;
}
@RequestMapping(value = "teacher/info.html", method = RequestMethod.POST)
@ResponseBody
public Result getTeacher(@RequestBody Map<String, Object> param) {
String mobile = (String) param.get("mobile");
String verifyCode = (String) param.get("verifyCode");
Result result = iTeacherService.getTeacherByMobile(mobile, verifyCode);
return result;
}
@RequestMapping(value = "teacher/joinus.html", method = RequestMethod.POST)
@ResponseBody
public Result teacherJoinus(@RequestBody TeacherEntity teacher) {
iTeacherService.joinus(teacher);
return Result.successResult(null);
}
}

@ -7,10 +7,10 @@
<meta name="keyword" content="探果题库,高校名师,名师专访,名师教案,名师课堂试题库,试卷库,智能题库,历年真题,模拟试题,押题,预测试题,高考,会计证,会计从业,会计师,经济师,施工员,建造师,建筑师,造价师,职业资格,证券资格,考研,计算机考试,建筑考试,财会类,医卫类,护士资格,公务员,知识点,试题,试卷"/>
<meta name="author" content="Tamguo Team" />
<meta name="copyright" content="Tamguo" />
<link rel="stylesheet" type="text/css" th:href="${setting.domain + 'css/reset.css'}" />
<link rel="stylesheet" type="text/css" th:href="${setting.domain + 'css/footer.css'}" />
<link rel="stylesheet" type="text/css" th:href="${setting.domain + 'css/teacher/joinus.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${setting.domain + 'images/favicon.png'}" />
<link rel="stylesheet" type="text/css" th:href="${domainName + 'css/reset.css'}" />
<link rel="stylesheet" type="text/css" th:href="${domainName + 'css/footer.css'}" />
<link rel="stylesheet" type="text/css" th:href="${domainName + 'css/teacher/joinus.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${domainName + 'images/favicon.png'}" />
<!-- 引入样式 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.4.2/lib/theme-chalk/index.css">
</head>
@ -18,8 +18,8 @@
<div id="wrapper" class="">
<div id="head">
<div class="mod-header">
<a th:href="${setting.domain}" style="display: block;">
<img th:src="${setting.domain + 'images/logo_731bc32.png'}" alt="logo"></a>
<a th:href="${domainName}" style="display: block;">
<img th:src="${domainName + 'images/logo_731bc32.png'}" alt="logo"></a>
</div>
</div>
<div id="nav">
@ -143,7 +143,7 @@
</div>
<div class="login-link" id="login_link">
<span>我已加入,现在就</span>
<button class="login-btn" id="login_btn"><a th:href="${setting.adminDomain}">登录</a></button></div>
<button class="login-btn" id="login_btn"><a th:href="${adminDomain}">登录</a></button></div>
</div>
<div id="foot">
<div class="mod-footer">
@ -156,11 +156,11 @@
<div th:replace="include/footer :: footer"></div>
</body>
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${setting.domain}]];
var mainHttp = [[${domainName}]];
</script>
<!-- 引入组件库 -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.4.2/lib/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script type="text/javascript" th:src="${setting.domain + 'js/teacher/joinus.js'}"></script>
<script type="text/javascript" th:src="${domainName + 'js/teacher/joinus.js'}"></script>
</html>
Loading…
Cancel
Save