commit
1d4faeda52
22 changed files with 2248 additions and 984 deletions
@ -0,0 +1,473 @@ |
||||
package com.yipin.liuwanr.controller; |
||||
|
||||
import com.yipin.liuwanr.entity.Staff; |
||||
import com.yipin.liuwanr.entity.Student; |
||||
import com.yipin.liuwanr.entity.UserInfo; |
||||
import com.yipin.liuwanr.entity.UserM; |
||||
import com.yipin.liuwanr.helper.RedisHelper; |
||||
import com.yipin.liuwanr.service.StaffService; |
||||
import com.yipin.liuwanr.service.StudentService; |
||||
import com.yipin.liuwanr.service.UserService; |
||||
import com.yipin.liuwanr.vo.UserVO; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
@RestController |
||||
@RequestMapping("/userInfo") |
||||
public class UserInfoController { |
||||
|
||||
@Autowired |
||||
private UserService userService; |
||||
|
||||
@Autowired |
||||
private StudentService studentService; |
||||
|
||||
@Autowired |
||||
private StaffService staffService; |
||||
|
||||
@Autowired |
||||
RedisHelper redisHelper; |
||||
|
||||
/** |
||||
* 添加用户 |
||||
*/ |
||||
@Transactional |
||||
@PostMapping("/addUser") |
||||
Response addUser(@RequestBody UserVO vo) { |
||||
Response resp = new Response(); |
||||
//用户实体
|
||||
UserM user = vo.getUser(); |
||||
//学生实体
|
||||
Student student = vo.getStudent(); |
||||
//员工实体
|
||||
Staff staff = vo.getStaff(); |
||||
//用户手机号
|
||||
String phone = user.getPhone(); |
||||
//用户名称
|
||||
String name = user.getName(); |
||||
//省份id
|
||||
Integer provinceId = user.getProvinceId(); |
||||
//用户角色id
|
||||
Integer accountRole = user.getAccountRole(); |
||||
//城市id
|
||||
Integer cityId = user.getCityId(); |
||||
//学校id
|
||||
Integer schoolId = user.getSchoolId(); |
||||
if (phone==null||phone=="") { |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("电话不能为空!"); |
||||
}else if(name==null||name==""){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("姓名不能为空!"); |
||||
}else if(provinceId==null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("省份不能为空!"); |
||||
}else if(accountRole==null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户角色不能为空!"); |
||||
}else if(cityId==null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("城市不能为空!"); |
||||
}else if(schoolId==null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("学校不能为空!"); |
||||
}else { |
||||
HashMap<String, Object> ret = userService.addUser(user); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
if (accountRole == 4){ |
||||
HashMap<String, Object> stu = studentService.addStudent(student); |
||||
int stuStatus = (int) stu.get("retcode"); |
||||
if (stuStatus == 200){ |
||||
resp.setStatus(stuStatus); |
||||
resp.setMessage(stu.get("retvalue")); |
||||
}else { |
||||
resp.setStatus(stuStatus); |
||||
resp.setErrmessage(stu.get("retvalue").toString()); |
||||
throw new RuntimeException(); |
||||
} |
||||
} |
||||
if(accountRole == 3||accountRole==2){ |
||||
HashMap<String, Object> sta = staffService.addStaff(staff); |
||||
int staStatus = (int) sta.get("retcode"); |
||||
if (staStatus == 200){ |
||||
resp.setStatus(staStatus); |
||||
resp.setMessage(sta.get("retvalue")); |
||||
}else { |
||||
resp.setStatus(staStatus); |
||||
resp.setErrmessage(sta.get("retvalue").toString()); |
||||
throw new RuntimeException(); |
||||
} |
||||
} |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
throw new RuntimeException(); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
/** |
||||
* 查询用户(根据国家、省份、城市) |
||||
*/ |
||||
@GetMapping("/queryUserInfo") |
||||
Response queryUserInfo(@RequestParam String countries, Integer provinceId, Integer cityId, Integer pageNo, Integer pageSize, Integer schoolId, Integer roleId, String searchContent, Integer month, String creationTime, String endTime) { |
||||
Response resp = new Response(); |
||||
UserInfo userInfo = new UserInfo(); |
||||
//设置国家
|
||||
if (countries != null&&countries!="") { |
||||
userInfo.setCountries(countries); |
||||
} |
||||
//设置省份
|
||||
if(provinceId!=null) { |
||||
userInfo.setProvinceId(provinceId); |
||||
} |
||||
//设置城市
|
||||
if(cityId!=null) { |
||||
userInfo.setCityId(cityId); |
||||
} |
||||
//学校
|
||||
if (schoolId!=null) { |
||||
userInfo.setSchoolId(schoolId); |
||||
} |
||||
//角色
|
||||
if (roleId!=null) { |
||||
userInfo.setRoleId(roleId); |
||||
} |
||||
//搜索内容
|
||||
if (searchContent!=null&&searchContent!="") { |
||||
userInfo.setSearchContent(searchContent); |
||||
} |
||||
//月份
|
||||
if (month!=null) { |
||||
userInfo.setMonth(month);; |
||||
} |
||||
//创建时间
|
||||
if (creationTime!=null&&creationTime!="") { |
||||
userInfo.setCreationTime(creationTime); |
||||
} |
||||
//结束时间
|
||||
if (endTime!=null&&endTime!="") { |
||||
userInfo.setEndTime(endTime); |
||||
} |
||||
HashMap<String, Object> ret = userService.queryUserInfo(userInfo,pageNo,pageSize); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
/** |
||||
* 删除用户(根据ID修改isdel状态,0可见 1不可见) |
||||
*/ |
||||
@Transactional |
||||
@PostMapping("/deleteUserInfo") |
||||
Response deleteUser(@RequestBody List<UserM> userList) { |
||||
Response resp = new Response(); |
||||
int size = userList.size(); |
||||
for(int i=0;i<size;i++){ |
||||
UserM user = userList.get(i); |
||||
Integer userId = user.getUserId(); |
||||
Integer roleId = user.getAccountRole(); |
||||
String phone = user.getPhone(); |
||||
if (userId==null) { |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户id为空,删除用户失败!"); |
||||
}else if (phone==null||phone==""){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户电话为空,删除用户失败!"); |
||||
}else if (roleId==null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户角色为空,删除用户失败!"); |
||||
} else { |
||||
HashMap<String, Object> ret = userService.deleteUser(userId); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
if (roleId==3||roleId==2){ |
||||
HashMap<String, Object> sta = userService.deleteStaff(user); |
||||
int staStatus = (int) ret.get("retcode"); |
||||
if (200 == staStatus) { |
||||
resp.setStatus(staStatus); |
||||
resp.setMessage(sta.get("retvalue")); |
||||
}else{ |
||||
resp.setStatus(staStatus); |
||||
resp.setErrmessage(sta.get("retvalue").toString()); |
||||
throw new RuntimeException(); |
||||
} |
||||
} |
||||
if (roleId==4){ |
||||
HashMap<String, Object> stu = userService.deleteStudent(user); |
||||
int stuStatus = (int) stu.get("retcode"); |
||||
if (200 == stuStatus) { |
||||
resp.setStatus(stuStatus); |
||||
resp.setMessage(stu.get("retvalue")); |
||||
}else{ |
||||
resp.setStatus(stuStatus); |
||||
resp.setErrmessage(stu.get("retvalue").toString()); |
||||
throw new RuntimeException(); |
||||
} |
||||
} |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
throw new RuntimeException(); |
||||
} |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
/** |
||||
* 更新用户 |
||||
*/ |
||||
@Transactional |
||||
@PostMapping("/updateUser") |
||||
Response updateUser(@RequestBody UserVO vo) { |
||||
Response resp = new Response(); |
||||
UserM user = vo.getUser(); |
||||
Staff staff = vo.getStaff(); |
||||
Student student = vo.getStudent(); |
||||
Integer userId = user.getUserId(); |
||||
Integer roleId = user.getAccountRole(); |
||||
if (userId==null) { |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户ID为空,修改用户失败!"); |
||||
}else if (roleId==null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("角色ID为空,修改用户失败!"); |
||||
} |
||||
else { |
||||
HashMap<String, Object> ret = userService.updateUser(user); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
if (roleId ==3||roleId==2){ |
||||
HashMap<String, Object> sta = userService.updateStaff(staff); |
||||
int staStatus = (int) sta.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(staStatus); |
||||
resp.setMessage(sta.get("retvalue")); |
||||
}else{ |
||||
resp.setStatus(staStatus); |
||||
resp.setErrmessage(sta.get("retvalue").toString()); |
||||
throw new RuntimeException("修改员工失败!"); |
||||
} |
||||
} |
||||
if (roleId ==4){ |
||||
HashMap<String, Object> stu = userService.updateStudent(student); |
||||
int stuStatus = (int) stu.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(stuStatus); |
||||
resp.setMessage(stu.get("retvalue")); |
||||
}else{ |
||||
resp.setStatus(stuStatus); |
||||
resp.setErrmessage(stu.get("retvalue").toString()); |
||||
throw new RuntimeException("修改学生失败!"); |
||||
} |
||||
} |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
throw new RuntimeException("修改用户失败!"); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 登陆(前台传来的key必须是phone、password) |
||||
*/ |
||||
@GetMapping("/logins") |
||||
Response logins(@RequestParam("phone") String phone, @RequestParam("password") String password, |
||||
HttpServletRequest req, HttpServletResponse res) { |
||||
Response resp = new Response(); |
||||
UserM user = new UserM(); |
||||
if (phone != null) { |
||||
user.setPhone(phone); |
||||
}if(password!=null) { |
||||
user.setPassword(password); |
||||
} |
||||
HashMap<String, Object> ret = userService.logins(user); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 查询用户详情(ID) |
||||
*/ |
||||
@GetMapping("/queryUserDetails") |
||||
Response queryUserDetails(@RequestParam Integer userId, Integer roleId) { |
||||
Response resp = new Response(); |
||||
if (roleId == null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户角色id为空!查询失败!"); |
||||
}else if (userId==null) { |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户id为空!查询失败!"); |
||||
}else { |
||||
HashMap<String, Object> ret = userService.queryUserDetails(userId,roleId); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
@PostMapping("/uploadUserAvatars") |
||||
Response uploadUserAvatars(MultipartFile file, Integer userId) { |
||||
Response resp = new Response(); |
||||
if (userId==null) {//前台传来的值是否为空
|
||||
resp.setStatus(300); |
||||
resp.setErrmessage("Parameter Invalid"); |
||||
}else { |
||||
HashMap<String, Object> ret = userService.uploadUserAvatars(file,userId); |
||||
|
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
/** |
||||
* 更新登录次数和时间 |
||||
*/ |
||||
@PostMapping("/updateLogInNumber") |
||||
Response updateLogInNumber(@RequestBody UserM user) { |
||||
Response resp = new Response(); |
||||
Integer userId = user.getUserId(); |
||||
String phone = user.getPhone(); |
||||
Integer accountRole = user.getAccountRole(); |
||||
if (userId==null) { |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户id不能为空!"); |
||||
}else if(phone==null||phone==""){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户电话不能为空!"); |
||||
} else if(accountRole==null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户角色不能为空!"); |
||||
} else { |
||||
HashMap<String, Object> ret = userService.updateLogInNumber(user); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
/** |
||||
* 用户模块查询客户 |
||||
*/ |
||||
@GetMapping("/queryCustomer") |
||||
Response queryCustomer(@RequestParam Integer cityId, Integer provinceId) { |
||||
Response resp = new Response(); |
||||
if(provinceId == null){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("省份id为空!查询失败!"); |
||||
}else if (cityId==null) { |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("城市id为空!查询失败!"); |
||||
}else { |
||||
HashMap<String, Object> ret = userService.queryCustomer(cityId,provinceId); |
||||
resp.setStatus(200); |
||||
resp.setErrmessage("查询成功!"); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
/** |
||||
* 查询账号是否存在 |
||||
*/ |
||||
@GetMapping("/queryAccountIsExist") |
||||
Response queryAccountIsExist(@RequestParam String userAccount) { |
||||
Response resp = new Response(); |
||||
if (userAccount==null) { |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("账号为空!"); |
||||
}else { |
||||
HashMap<String, Object> ret = userService.queryAccountIsExist(userAccount); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
/** |
||||
* 查询学号、工号是否存在 |
||||
*/ |
||||
@GetMapping("/queryWorkNumberIsExist") |
||||
Response queryWorkNumberIsExist(@RequestParam String workNumber) { |
||||
Response resp = new Response(); |
||||
if (workNumber==null) { |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("账号为空!"); |
||||
}else { |
||||
HashMap<String, Object> ret = userService.queryWorkNumberIsExist(workNumber); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
} |
@ -0,0 +1,402 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 用户信息实体 |
||||
* |
||||
* @author Ning |
||||
*/ |
||||
public class UserInfo { |
||||
//用户id
|
||||
private Integer userId; |
||||
//角色id
|
||||
private Integer roleId; |
||||
//用户姓名
|
||||
private String userName; |
||||
//用户账号
|
||||
private String account; |
||||
//用户密码
|
||||
private String password; |
||||
//国家
|
||||
private String countries; |
||||
//绑定省份id
|
||||
private Integer provinceId; |
||||
//绑定城市id
|
||||
private Integer cityId; |
||||
//创建时间
|
||||
private String creationTime; |
||||
//登陆次数
|
||||
private Integer logInNumber; |
||||
//上次登陆时间
|
||||
private String lastTimeOfLanding; |
||||
//性别
|
||||
private Integer sex; |
||||
//证件类型(1、身份证)
|
||||
private Integer documentType; |
||||
//身份证
|
||||
private String IDNumber; |
||||
//教育程度(1、研究数及以上)
|
||||
private Integer educationDegree; |
||||
//电话
|
||||
private String phone; |
||||
//微信账号
|
||||
private String WeChatID; |
||||
//出生日期
|
||||
private String dateBirth; |
||||
//邮箱
|
||||
private String email; |
||||
//学校id
|
||||
private Integer schoolId; |
||||
//唯一标示性账号
|
||||
private String uniqueIdentificationAccount; |
||||
//搜索内容
|
||||
private String searchContent; |
||||
private List<UserInfo> user; |
||||
//用户头像路径
|
||||
private String userAvatars; |
||||
//------------------------------------------------
|
||||
//学校名称
|
||||
private String schoolName; |
||||
//省份名称
|
||||
private String provinceName; |
||||
//城市名称
|
||||
private String cityName; |
||||
//条件查询月
|
||||
private Integer month; |
||||
//条件查询结束时间
|
||||
private String endTime; |
||||
//专业类ID
|
||||
private Integer professionalClassId; |
||||
//专业类名称
|
||||
private String professionalClassName; |
||||
//学科ID
|
||||
private Integer disciplineId; |
||||
//学科名称
|
||||
private String disciplineName; |
||||
//专业id
|
||||
private Integer professionalId; |
||||
//专业名称
|
||||
private String professionalName; |
||||
|
||||
public Integer getUserId() { |
||||
return userId; |
||||
} |
||||
|
||||
public void setUserId(Integer userId) { |
||||
this.userId = userId; |
||||
} |
||||
|
||||
public String getUserName() { |
||||
return userName; |
||||
} |
||||
|
||||
public void setUserName(String userName) { |
||||
this.userName = userName; |
||||
} |
||||
|
||||
public String getAccount() { |
||||
return account; |
||||
} |
||||
|
||||
public void setAccount(String account) { |
||||
this.account = account; |
||||
} |
||||
|
||||
public String getPassword() { |
||||
return password; |
||||
} |
||||
|
||||
public void setPassword(String password) { |
||||
this.password = password; |
||||
} |
||||
|
||||
public String getCountries() { |
||||
return countries; |
||||
} |
||||
|
||||
public void setCountries(String countries) { |
||||
this.countries = countries; |
||||
} |
||||
|
||||
public Integer getProvinceId() { |
||||
return provinceId; |
||||
} |
||||
|
||||
public void setProvinceId(Integer provinceId) { |
||||
this.provinceId = provinceId; |
||||
} |
||||
|
||||
public Integer getCityId() { |
||||
return cityId; |
||||
} |
||||
|
||||
public void setCityId(Integer cityId) { |
||||
this.cityId = cityId; |
||||
} |
||||
|
||||
public String getCreationTime() { |
||||
return creationTime; |
||||
} |
||||
|
||||
public void setCreationTime(String creationTime) { |
||||
this.creationTime = creationTime; |
||||
} |
||||
|
||||
public Integer getLogInNumber() { |
||||
return logInNumber; |
||||
} |
||||
|
||||
public void setLogInNumber(Integer logInNumber) { |
||||
this.logInNumber = logInNumber; |
||||
} |
||||
|
||||
public String getLastTimeOfLanding() { |
||||
return lastTimeOfLanding; |
||||
} |
||||
|
||||
public void setLastTimeOfLanding(String lastTimeOfLanding) { |
||||
this.lastTimeOfLanding = lastTimeOfLanding; |
||||
} |
||||
|
||||
public Integer getSex() { |
||||
return sex; |
||||
} |
||||
|
||||
public void setSex(Integer sex) { |
||||
this.sex = sex; |
||||
} |
||||
|
||||
public Integer getDocumentType() { |
||||
return documentType; |
||||
} |
||||
|
||||
public void setDocumentType(Integer documentType) { |
||||
this.documentType = documentType; |
||||
} |
||||
|
||||
public String getIDNumber() { |
||||
return IDNumber; |
||||
} |
||||
|
||||
public void setIDNumber(String IDNumber) { |
||||
this.IDNumber = IDNumber; |
||||
} |
||||
|
||||
public Integer getEducationDegree() { |
||||
return educationDegree; |
||||
} |
||||
|
||||
public void setEducationDegree(Integer educationDegree) { |
||||
this.educationDegree = educationDegree; |
||||
} |
||||
|
||||
public String getPhone() { |
||||
return phone; |
||||
} |
||||
|
||||
public void setPhone(String phone) { |
||||
this.phone = phone; |
||||
} |
||||
|
||||
public String getWeChatID() { |
||||
return WeChatID; |
||||
} |
||||
|
||||
public void setWeChatID(String weChatID) { |
||||
WeChatID = weChatID; |
||||
} |
||||
|
||||
public String getDateBirth() { |
||||
return dateBirth; |
||||
} |
||||
|
||||
public void setDateBirth(String dateBirth) { |
||||
this.dateBirth = dateBirth; |
||||
} |
||||
|
||||
public String getEmail() { |
||||
return email; |
||||
} |
||||
|
||||
public void setEmail(String email) { |
||||
this.email = email; |
||||
} |
||||
|
||||
public Integer getSchoolId() { |
||||
return schoolId; |
||||
} |
||||
|
||||
public void setSchoolId(Integer schoolId) { |
||||
this.schoolId = schoolId; |
||||
} |
||||
|
||||
public String getUniqueIdentificationAccount() { |
||||
return uniqueIdentificationAccount; |
||||
} |
||||
|
||||
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) { |
||||
this.uniqueIdentificationAccount = uniqueIdentificationAccount; |
||||
} |
||||
|
||||
public String getSearchContent() { |
||||
return searchContent; |
||||
} |
||||
|
||||
public void setSearchContent(String searchContent) { |
||||
this.searchContent = searchContent; |
||||
} |
||||
|
||||
public List<UserInfo> getUser() { |
||||
return user; |
||||
} |
||||
|
||||
public void setUser(List<UserInfo> user) { |
||||
this.user = user; |
||||
} |
||||
|
||||
public String getUserAvatars() { |
||||
return userAvatars; |
||||
} |
||||
|
||||
public void setUserAvatars(String userAvatars) { |
||||
this.userAvatars = userAvatars; |
||||
} |
||||
|
||||
public String getSchoolName() { |
||||
return schoolName; |
||||
} |
||||
|
||||
public void setSchoolName(String schoolName) { |
||||
this.schoolName = schoolName; |
||||
} |
||||
|
||||
public String getProvinceName() { |
||||
return provinceName; |
||||
} |
||||
|
||||
public void setProvinceName(String provinceName) { |
||||
this.provinceName = provinceName; |
||||
} |
||||
|
||||
public String getCityName() { |
||||
return cityName; |
||||
} |
||||
|
||||
public void setCityName(String cityName) { |
||||
this.cityName = cityName; |
||||
} |
||||
|
||||
public Integer getMonth() { |
||||
return month; |
||||
} |
||||
|
||||
public void setMonth(Integer month) { |
||||
this.month = month; |
||||
} |
||||
|
||||
public String getEndTime() { |
||||
return endTime; |
||||
} |
||||
|
||||
public void setEndTime(String endTime) { |
||||
this.endTime = endTime; |
||||
} |
||||
|
||||
public Integer getProfessionalClassId() { |
||||
return professionalClassId; |
||||
} |
||||
|
||||
public void setProfessionalClassId(Integer professionalClassId) { |
||||
this.professionalClassId = professionalClassId; |
||||
} |
||||
|
||||
public String getProfessionalClassName() { |
||||
return professionalClassName; |
||||
} |
||||
|
||||
public void setProfessionalClassName(String professionalClassName) { |
||||
this.professionalClassName = professionalClassName; |
||||
} |
||||
|
||||
public Integer getDisciplineId() { |
||||
return disciplineId; |
||||
} |
||||
|
||||
public void setDisciplineId(Integer disciplineId) { |
||||
this.disciplineId = disciplineId; |
||||
} |
||||
|
||||
public String getDisciplineName() { |
||||
return disciplineName; |
||||
} |
||||
|
||||
public void setDisciplineName(String disciplineName) { |
||||
this.disciplineName = disciplineName; |
||||
} |
||||
|
||||
public Integer getProfessionalId() { |
||||
return professionalId; |
||||
} |
||||
|
||||
public void setProfessionalId(Integer professionalId) { |
||||
this.professionalId = professionalId; |
||||
} |
||||
|
||||
public String getProfessionalName() { |
||||
return professionalName; |
||||
} |
||||
|
||||
public void setProfessionalName(String professionalName) { |
||||
this.professionalName = professionalName; |
||||
} |
||||
|
||||
public Integer getRoleId() { |
||||
return roleId; |
||||
} |
||||
|
||||
public void setRoleId(Integer roleId) { |
||||
this.roleId = roleId; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "UserInfo{" + |
||||
"userId=" + userId + |
||||
", roleId=" + roleId + |
||||
", userName='" + userName + '\'' + |
||||
", account='" + account + '\'' + |
||||
", password='" + password + '\'' + |
||||
", countries='" + countries + '\'' + |
||||
", provinceId=" + provinceId + |
||||
", cityId=" + cityId + |
||||
", creationTime='" + creationTime + '\'' + |
||||
", logInNumber=" + logInNumber + |
||||
", lastTimeOfLanding='" + lastTimeOfLanding + '\'' + |
||||
", sex=" + sex + |
||||
", documentType=" + documentType + |
||||
", IDNumber='" + IDNumber + '\'' + |
||||
", educationDegree=" + educationDegree + |
||||
", phone='" + phone + '\'' + |
||||
", WeChatID='" + WeChatID + '\'' + |
||||
", dateBirth='" + dateBirth + '\'' + |
||||
", email='" + email + '\'' + |
||||
", schoolId=" + schoolId + |
||||
", uniqueIdentificationAccount='" + uniqueIdentificationAccount + '\'' + |
||||
", searchContent='" + searchContent + '\'' + |
||||
", user=" + user + |
||||
", userAvatars='" + userAvatars + '\'' + |
||||
", schoolName='" + schoolName + '\'' + |
||||
", provinceName='" + provinceName + '\'' + |
||||
", cityName='" + cityName + '\'' + |
||||
", month=" + month + |
||||
", endTime='" + endTime + '\'' + |
||||
", professionalClassId=" + professionalClassId + |
||||
", professionalClassName='" + professionalClassName + '\'' + |
||||
", disciplineId=" + disciplineId + |
||||
", disciplineName='" + disciplineName + '\'' + |
||||
", professionalId=" + professionalId + |
||||
", professionalName='" + professionalName + '\'' + |
||||
'}'; |
||||
} |
||||
} |
@ -1,4 +1,8 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
package com.yipin.liuwanr.vo; |
||||
|
||||
import com.yipin.liuwanr.entity.ContractInformation; |
||||
import com.yipin.liuwanr.entity.CoursePermissions; |
||||
import com.yipin.liuwanr.entity.Order; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
@ -0,0 +1,217 @@ |
||||
package com.yipin.liuwanr; |
||||
|
||||
import com.yipin.liuwanr.entity.*; |
||||
import com.yipin.liuwanr.service.OrderService; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
import org.springframework.test.context.junit4.SpringRunner; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.text.ParseException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
@RunWith(SpringRunner.class) |
||||
@SpringBootTest |
||||
public class OrderServiceTest { |
||||
@Autowired |
||||
private OrderService orderService; |
||||
|
||||
//添加合同信息
|
||||
@Test |
||||
@Transactional |
||||
public void addOrder() { |
||||
Order order = new Order(); |
||||
order.setOrderNumber("1596424017647"); |
||||
order.setCustomerName("测试"); |
||||
order.setOrderName("测试"); |
||||
order.setOrderAmount("120"); |
||||
order.setOrderType(1); |
||||
order.setProvinceId(1); |
||||
order.setCityId(1); |
||||
order.setOrderContact("张三"); |
||||
order.setPhone("15267668899"); |
||||
order.setEmail("123@qq.com"); |
||||
order.setCustomerId(126); |
||||
HashMap<String, Object> map = orderService.addOrder(order); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void addContractInformation() { |
||||
ContractInformation contractInformation = new ContractInformation(); |
||||
contractInformation.setContractInformationName("1"); |
||||
contractInformation.setContractInformationNumber("1"); |
||||
contractInformation.setContractInformationSum("1"); |
||||
contractInformation.setContractInformationLink("1"); |
||||
contractInformation.setOrderId(20); |
||||
HashMap<String, Object> map = orderService.addContractInformation(contractInformation); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//添加课程权限
|
||||
@Test |
||||
@Transactional |
||||
public void addCoursePermissionss() throws ParseException { |
||||
List<CoursePermissions> coursePermissionss = new ArrayList<>(); |
||||
CoursePermissions coursePermissions = new CoursePermissions(); |
||||
coursePermissions.setCourseId(77); |
||||
coursePermissions.setUsePeriod(30); |
||||
coursePermissions.setMarketPrice(12.8); |
||||
coursePermissions.setTransactionPrice(1); |
||||
coursePermissions.setDiscount(7); |
||||
coursePermissions.setPortAddressId(1); |
||||
coursePermissions.setIsDeliverGoods(1); |
||||
coursePermissions.setOrderId(118); |
||||
coursePermissionss.add(coursePermissions); |
||||
HashMap<String, Object> map = orderService.addCoursePermissionss(coursePermissionss); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//绑定应用权限
|
||||
@Test |
||||
@Transactional |
||||
public void bindingApplicationPermissions() { |
||||
ApplicationPermissions applicationPermissions = new ApplicationPermissions(); |
||||
applicationPermissions.setSystemId("2"); |
||||
applicationPermissions.setOrderId(2); |
||||
HashMap<String, Object> map = orderService.bindingApplicationPermissions(applicationPermissions); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryCoursePermissions() { |
||||
String courseId = "1"; |
||||
HashMap<String, Object> map = orderService.queryCoursePermissions(courseId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryOrder() { |
||||
Order order = new Order(); |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> map = orderService.queryOrder(order, pageNo, pageSize); |
||||
Integer retcode = (Integer) map.get("retcode"); |
||||
System.out.println(retcode); |
||||
if (retcode == 200) { |
||||
PageResult pageResult = (PageResult) map.get("retvalue"); |
||||
Long total = pageResult.getTotal(); |
||||
System.out.println("total = " + total); |
||||
List<Order> rows = (List<Order>) pageResult.getRows(); |
||||
rows.forEach(item -> System.out.println(item.toString())); |
||||
} else { |
||||
String msg = (String) map.get("retvalue"); |
||||
System.out.println(msg); |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryOrderDetails() { |
||||
Integer orderId = 1; |
||||
HashMap<String, Object> map = orderService.queryOrderDetails(orderId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void deleteOrder() { |
||||
List<Integer> orderId = new ArrayList<>(); |
||||
orderId.add(1); |
||||
orderId.add(2); |
||||
orderId.add(3); |
||||
HashMap<String, Object> map = orderService.deleteOrder(orderId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void updateOrder() { |
||||
Order order = new Order(); |
||||
HashMap<String, Object> map = orderService.updateOrder(order); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void deleteCoursePermissions() { |
||||
Integer orderId = 1; |
||||
HashMap<String, Object> map = orderService.deleteCoursePermissions(orderId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void updateCoursePermissions() { |
||||
List<CoursePermissions> coursePermissionss = new ArrayList<>(); |
||||
CoursePermissions coursePermissions = new CoursePermissions(); |
||||
coursePermissionss.add(coursePermissions); |
||||
HashMap<String, Object> map = orderService.updateCoursePermissions(coursePermissionss); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void updateContractInformation() { |
||||
ContractInformation contractInformation = new ContractInformation(); |
||||
HashMap<String, Object> map = orderService.updateContractInformation(contractInformation); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//绑定应用权限
|
||||
@Test |
||||
@Transactional |
||||
public void isDeliverGoods() { |
||||
CoursePermissions coursePermissions = new CoursePermissions(); |
||||
HashMap<String, Object> map = orderService.isDeliverGoods(coursePermissions); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryOrderCustomer() { |
||||
Integer cityId = 1; |
||||
Integer provinceId = 1; |
||||
HashMap<String, Object> map = orderService.queryOrderCustomer(cityId, provinceId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void queryOrderCustomerContact() { |
||||
Integer customerId = 1; |
||||
HashMap<String, Object> map = orderService.queryOrderCustomerContact(customerId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
//查询订单课程列表
|
||||
@Test |
||||
@Transactional |
||||
public void queryCourseList() { |
||||
String searchContent = ""; |
||||
List<Integer> courseId = new ArrayList<>(); |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> map = orderService.queryCourseList(searchContent, courseId, pageNo, pageSize); |
||||
Integer retcode = (Integer) map.get("retcode"); |
||||
System.out.println(retcode); |
||||
if (retcode == 200) { |
||||
PageResult pageResult = (PageResult) map.get("retvalue"); |
||||
Long total = pageResult.getTotal(); |
||||
System.out.println("total = " + total); |
||||
List<Course> rows = (List<Course>) pageResult.getRows(); |
||||
rows.forEach(item -> System.out.println(item.toString())); |
||||
} else { |
||||
String msg = (String) map.get("retvalue"); |
||||
System.out.println(msg); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,83 @@ |
||||
package com.yipin.liuwanr; |
||||
|
||||
import com.yipin.liuwanr.entity.PageResult; |
||||
import com.yipin.liuwanr.entity.ServiceConfig; |
||||
import com.yipin.liuwanr.service.ServiceConfigService; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
import org.springframework.test.context.junit4.SpringRunner; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
@RunWith(SpringRunner.class) |
||||
@SpringBootTest |
||||
public class ServiceConfigServiceTest { |
||||
@Autowired |
||||
private ServiceConfigService serviceConfigService; |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void addServiceConfig() { |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
serviceConfig.setSystemName("测试"); |
||||
serviceConfig.setSystemType(2); |
||||
serviceConfig.setSystemAttribution(2); |
||||
serviceConfig.setSystemStatus(1); |
||||
HashMap<String, Object> map = serviceConfigService.addServiceConfig(serviceConfig); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
public void queryServiceConfig() { |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> map = serviceConfigService.queryServiceConfig(serviceConfig, pageNo, pageSize); |
||||
Integer retcode = (Integer) map.get("retcode"); |
||||
System.out.println(retcode); |
||||
if (retcode == 200) { |
||||
PageResult pageResult = (PageResult) map.get("retvalue"); |
||||
Long total = pageResult.getTotal(); |
||||
System.out.println("total = " + total); |
||||
List<ServiceConfig> rows = (List<ServiceConfig>) pageResult.getRows(); |
||||
rows.forEach(item -> System.out.println(item.toString())); |
||||
} else { |
||||
String msg = (String) map.get("retvalue"); |
||||
System.out.println(msg); |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void queryServiceConfigDetails() { |
||||
Integer systemId = 1; |
||||
HashMap<String, Object> map = serviceConfigService.queryServiceConfigDetails(systemId); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void deleteServiceConfig() { |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
serviceConfig.setSystemId(1); |
||||
HashMap<String, Object> map = serviceConfigService.deleteServiceConfig(serviceConfig); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
@Test |
||||
@Transactional |
||||
public void updateServiceConfig() { |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
serviceConfig.setSystemName("测试"); |
||||
serviceConfig.setSystemType(2); |
||||
serviceConfig.setSystemAttribution(2); |
||||
serviceConfig.setSystemStatus(1); |
||||
serviceConfig.setSystemId(1); |
||||
HashMap<String, Object> map = serviceConfigService.updateServiceConfig(serviceConfig); |
||||
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue