koul пре 6 година
родитељ
комит
b62d9077b2

+ 4 - 4
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxUserController.java

@@ -64,12 +64,12 @@ public class WxUserController {
 
 	/** 绑定 */
 	@PostMapping("/bindOpenid")
-	public ResultBean bindOpenid(@Param("userPhone")String userPhone, @Param("code")String code, @Param("openid")String openid){
+	public ResultBean bindOpenid(@Param("userPhone")String userPhone, @Param("code")String code, @Param("openid")String openid,@Param("headimgurl")String headimgurl){
 		try {
 			Assert.notNull(userPhone,"请填入手机号");
 			Assert.notNull(code,"请输入验证码");
 			Assert.notNull(openid,"openid不能为空");
-			Map<String, Object> map = userService.bindOpenid(userPhone, code, openid);
+			Map<String, Object> map = userService.bindOpenid(userPhone, code, openid,headimgurl);
 			return new ResultBean(map);
 		}catch (Exception e){
 			return new ResultBean(e);
@@ -77,10 +77,10 @@ public class WxUserController {
 	}
 
 	@GetMapping("/isBinding")
-	public ResultBean isBinding(String openid){
+	public ResultBean isBinding(@Param("openid") String openid,@Param("headimgurl")String headimgurl){
 		try {
 			Assert.notNull(openid,"openid不能为空");
-			Map<String, Object> map = userService.isBinding(openid);
+			Map<String, Object> map = userService.isBinding(openid,headimgurl);
 			Object teacherDOS =  map.get("teacherDOS");
 			Object parentsDOS = map.get("parentsDOS");
 			if (ObjectUtils.isEmpty(teacherDOS)&&ObjectUtils.isEmpty(parentsDOS)){

+ 2 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxUserService.java

@@ -33,7 +33,7 @@ public interface WxUserService {
 	 * @return
 	 * @throws Exception
 	 */
-	Map<String, Object> bindOpenid(@Param("userPhone") String userPhone, @Param("code") String code, @Param("openid") String openid) throws Exception;
+	Map<String, Object> bindOpenid(@Param("userPhone") String userPhone, @Param("code") String code, @Param("openid") String openid,@Param("headimgurl")String headimgurl) throws Exception;
 
 	/**
 	 * 是否绑定
@@ -41,7 +41,7 @@ public interface WxUserService {
 	 * @return
 	 * @throws Exception
 	 */
-	public HashMap<String, Object> isBinding(@Param("openid") String openid) throws Exception;
+	public HashMap<String, Object> isBinding(@Param("openid") String openid,@Param("headimgurl")String headimgurl) throws Exception;
 
 	/**
 	 * 首页数据

+ 9 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxUserServiceImpl.java

@@ -84,7 +84,7 @@ public class WxUserServiceImpl implements WxUserService {
 	 * @return
 	 * @throws Exception
 	 */
-	public Map<String, Object> bindOpenid(String userPhone, String code, String openid) throws Exception {
+	public Map<String, Object> bindOpenid(String userPhone, String code, String openid,String headimgurl) throws Exception {
 		UserDO user = userMapper.selectUserByPhone(userPhone);
 		if (ObjectUtils.isNotEmpty(user)){
 			Map<String, Object> map = new HashMap<>();
@@ -96,6 +96,7 @@ public class WxUserServiceImpl implements WxUserService {
 				if (ObjectUtils.isNotEmpty(teacherDOS)){
 					for (TeacherDO tc:teacherDOS) {
 						tc.setOpenid(openid);
+						tc.setTeacherPhoto(headimgurl);
 						teacherMapper.update(tc);
 						tc.setSchoolName(schoolMapper.get(tc.getSchoolId()).getSchoolName());
 					}
@@ -104,6 +105,7 @@ public class WxUserServiceImpl implements WxUserService {
 				if (ObjectUtils.isNotEmpty(parentsDOS)){
 					for (ParentsDO pt:parentsDOS) {
 						pt.setOpenid(openid);
+						pt.setParentsPhoto(headimgurl);
 						parentsMapper.update(pt);
 						pt.setSchoolName(schoolMapper.get(pt.getSchoolId()).getSchoolName());
 					}
@@ -243,19 +245,24 @@ public class WxUserServiceImpl implements WxUserService {
 	 * 是否绑定
 	 * @param openid
 	 */
-	public HashMap<String, Object> isBinding(String openid) throws Exception {
+	public HashMap<String, Object> isBinding(String openid,String headimgurl) throws Exception {
 		HashMap<String, Object> map = new HashMap<>();
 		Map<String, Object> hashMap = new HashMap<>();
 		hashMap.put("openid",openid);
 		List<TeacherDO> teacherDOS = teacherMapper.list(hashMap);
 		if (ObjectUtils.isNotEmpty(teacherDOS)){
 			for (TeacherDO tc:teacherDOS) {
+				tc.setTeacherPhoto(headimgurl);
+				teacherMapper.update(tc);
 				tc.setSchoolName(schoolMapper.get(tc.getSchoolId()).getSchoolName());
+
 			}
 		}
 		List<ParentsDO> parentsDOS = parentsMapper.list(hashMap);
 		if (ObjectUtils.isNotEmpty(parentsDOS)){
 			for (ParentsDO pt:parentsDOS) {
+				pt.setParentsPhoto(headimgurl);
+				parentsMapper.update(pt);
 				pt.setSchoolName(schoolMapper.get(pt.getSchoolId()).getSchoolName());
 			}
 		}