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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue