Commit e5f9f155 by 黄森林

微信公众号个人中心

parent e9db5efe
......@@ -5,6 +5,7 @@ import com.winsun.bean.School;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import java.util.List;
......@@ -14,7 +15,7 @@ import java.util.Map;
@Component
public interface SchoolMapper extends BaseMapper<School> {
@Select(" select * from hhr_school where id in( select school_id from hhr_user_school where user_id= #{userId} )")
@Select("select * from hhr_school where id in( select school_id from hhr_user_school where user_id= #{userId} )")
List<Map<String,Object>> getuserToSchool(@Param("userId")String userId);
@Select("select school_id schoolId from `hhr_user_school` where user_id = #{partner}")
......@@ -23,4 +24,10 @@ public interface SchoolMapper extends BaseMapper<School> {
@Select("SELECT sub_name FROM `hhr_school` GROUP BY sub_name")
List<String> selectAdress();
@Update("update hhr_user_school set school_id = #{schoolId} where user_id = #{userId}")
Integer updateUserSchool(@Param("userId")String usrId ,@Param("schoolId")String schoolId);
@Update("insert into hhr_user_school (school_id,user_id) values (#{schoolId},#{userId})")
Integer insertUserSchool(@Param("userId")String usrId ,@Param("schoolId")String schoolId);
}
......@@ -13,6 +13,7 @@ import com.winsun.mapper.HhrUserMapper;
import com.winsun.mapper.SchoolMapper;
import com.winsun.mapper.SysUserMapper;
import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.IDCardUtil;
import com.winsun.utils.MyBatisPlusUpdateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -74,6 +75,9 @@ public class PersonalCenterController extends BaseController {
if (!partner.equals(String.valueOf(user.getId()))) {
return ResponseData.error("当前登录账户和修改账号冲突!");
}
if(!IDCardUtil.IDCardValidate(idCard)){
return ResponseData.error("身份证号码有误!");
}
Wrapper<SysUser> wrapper = new EntityWrapper<>();
wrapper.eq("id", user.getId());
Map<String, Object> dataMap = new HashMap<>();
......@@ -87,9 +91,14 @@ public class PersonalCenterController extends BaseController {
Map<String, Object> dataMap1 = new HashMap<>();
dataMap1.put("grade", grade);
dataMap1.put("position", position);
dataMap1.put("idCard", idCard);
dataMap1.put("id_card", idCard);
integer += hhrUserMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMap1), wrapper1);
String sch = schoolMapper.selectSchoolIdByUserId(String.valueOf(user.getId()));
if(StringUtils.isBlank(sch)){
integer += schoolMapper.insertUserSchool(String.valueOf(user.getId()), school);
}else {
integer += schoolMapper.updateUserSchool(String.valueOf(user.getId()), school);
}
if(integer != 3){
return ResponseData.error("修改异常,请重新修改!");
}
......@@ -192,6 +201,7 @@ public class PersonalCenterController extends BaseController {
String schoolId = appMapper.selectSchoolId(partner);
String school = appMapper.selectSchoolById(schoolId);
hashMap.put("school", school);
hashMap.put("schoolId", schoolId);
hashMap.put("position", hhrUser.getPosition());
hashMap.put("createtime", sysUser.getCreatetime());
hashMap.put("wxNickName", hhrUser.getWxNickName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment