Sfoglia il codice sorgente

Merge branch 'groupNickName' of http://git.dayaedu.com/yonge/mec into test

 Conflicts:
	mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
zouxuan 4 anni fa
parent
commit
c1981bce04

+ 3 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.auth.web.controller;
 
+import com.ym.mec.im.WebFeignService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -56,7 +57,7 @@ public class UserController extends BaseController {
 	@Autowired
 	private IdGeneratorService smsCodeService;
 	@Autowired
-	private ESealPlugin eSealPlugin;
+	private WebFeignService webFeignService;
 	@Value("${message.debugMode}")
 	private boolean debugMode;
 	@Autowired
@@ -154,6 +155,7 @@ public class UserController extends BaseController {
 			ImResult register = imFeignService.register(new ImUserModel(sysUser.getId().toString(), username, sysUser.getAvatar()));
 			sysUser.setImToken(register.getToken());
 		}
+		webFeignService.updateNickName(sysUser.getId(),username,null);
 		password = new BCryptPasswordEncoder().encode(password);
 		sysUser.setPassword(password);
 		sysUser.setUpdateTime(new Date());

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/ImGroupService.java

@@ -58,5 +58,5 @@ public interface ImGroupService extends BaseService<Long, ImGroup> {
 	 * @param nickName
 	 * @return
 	 */
-    int updateNickName(Integer userId, String nickName);
+    int updateNickName(Integer userId, String nickName,String userType);
 }

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java

@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.service.ImGroupService;
 import com.ym.mec.biz.service.ImUserFriendService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -59,6 +60,8 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 	private ImUserFriendService imUserFriendService;
 	@Autowired
 	private OrganizationDao organizationDao;
+	@Autowired
+	private ImGroupService imGroupService;
 
 	@Override
 	public BaseDAO<Integer, Employee> getDAO() {
@@ -121,6 +124,7 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 		//新增用户角色
 		employeeDao.batchAddEmployeeRole(employee.getId(),employee.getRoleIds());
 		teacherDao.updateUser(employee);
+		imGroupService.updateNickName(employee.getUserId(),employee.getRealName(),"SYSTEM");
 	}
 
 	@Override

+ 30 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImGroupServiceImpl.java

@@ -3,6 +3,10 @@ package com.ym.mec.biz.service.impl;
 import java.util.Date;
 import java.util.List;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.common.entity.ImUserModel;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -38,6 +42,9 @@ public class ImGroupServiceImpl extends BaseServiceImpl<Long, ImGroup> implement
 	@Autowired
 	private ImFeignService imFeignService;
 
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
 	@Override
 	public BaseDAO<Long, ImGroup> getDAO() {
 		return imGroupDao;
@@ -120,8 +127,29 @@ public class ImGroupServiceImpl extends BaseServiceImpl<Long, ImGroup> implement
 	}
 
 	@Override
-	public int updateNickName(Integer userId, String nickName) {
-		return imGroupDao.updateNickname(userId,nickName);
+	@Transactional(rollbackFor = Exception.class)
+	public int updateNickName(Integer userId, String nickName,String userType) {
+		//修改群成员备注
+		int i = imGroupDao.updateNickname(userId, nickName);
+		//修改sysUser名称,如果包含学员的角色,那么修改userName。否则修改realName
+		SysUser sysUser = sysUserFeignService.queryUserById(userId);
+		if(StringUtils.isNotEmpty(userType)){
+			if("STUDENT" == userType){
+				sysUser.setUsername(nickName);
+			}else {
+				sysUser.setRealName(nickName);
+			}
+		}else {
+			if(sysUser.getUserType().contains("STUDENT")){
+				sysUser.setUsername(nickName);
+			}else {
+				sysUser.setRealName(nickName);
+			}
+			sysUserFeignService.updateSysUser(sysUser);
+		}
+		//同步融云基本信息
+		imFeignService.update(new ImUserModel(sysUser.getId().toString(),nickName,sysUser.getAvatar()));
+		return i;
 	}
 
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -17,6 +17,7 @@ import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.service.SysConfigService;
 
 import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.im.WebFeignService;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -109,6 +110,8 @@ public class StudentManageServiceImpl implements StudentManageService {
     private CourseScheduleDao courseScheduleDao;
     @Autowired
     private SysUserContractsDao sysUserContractsDao;
+    @Autowired
+    private WebFeignService webFeignService;
 
     @Override
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
@@ -613,6 +616,7 @@ public class StudentManageServiceImpl implements StudentManageService {
                 student.setUserType(sysUser.getUserType() + ",STUDENT");
                 student.setUpdateTime(date);
                 sysUserFeignService.updateSysUser(student);
+
             }
         } else {
             student.setUpdateTime(date);
@@ -666,6 +670,7 @@ public class StudentManageServiceImpl implements StudentManageService {
             LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
             studentExtracurricularExercisesSituationDao.deleteByStudent(student.getId(), monDayDate.toString());
         }
+        webFeignService.updateNickName(userId,student.getUsername(),"STUDENT");
         return userId;
     }
 

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -28,6 +28,7 @@ import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.event.source.GroupEventSource;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.im.WebFeignService;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -146,6 +147,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private GroupEventSource groupEventSource;
     @Autowired
     private StudentInstrumentService studentInstrumentService;
+    @Autowired
+    private WebFeignService webFeignService;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -358,6 +361,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         student.setCurrentClass(studentRegistration.getCurrentClass());
         studentDao.update(student);
 
+        webFeignService.updateNickName(sysUser.getId(),studentRegistration.getName(),"STUDENT");
         // 增加报名学生数
         musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
         // 报名成功后,发送短信
@@ -654,8 +658,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentDao.insert(new Student(userId, studentRegistration.getSubjectId().toString()));
                 //添加用户现金账户
                 sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
-                //添加用户电子签章账户
-//                contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
                 ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), null));
                 sysUser.setImToken(register.getToken());
                 teacherDao.updateUser(sysUser);
@@ -693,6 +695,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                         studentDao.update(student);
                     }
                 }
+                webFeignService.updateNickName(userId,sysUser.getUsername(),"STUDENT");
             }
             MusicGroupStudentFee studentFeeDaoByUser = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
             if (studentFeeDaoByUser != null) {

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java

@@ -21,6 +21,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
+import com.ym.mec.im.WebFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.idcard.IdcardValidator;
@@ -69,6 +70,8 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 	@Autowired
 	private ImFeignService imFeignService;
 	@Autowired
+	private WebFeignService webFeignService;
+	@Autowired
 	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
 	@Autowired
 	private StudentDao studentDao;
@@ -154,7 +157,8 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 		teacherDao.update(teacher);
 		teacher.setOrganId(null);
 		teacherDao.updateUser(teacher);
-		imFeignService.update(new ImUserModel(teacher.getId().toString(),teacher.getRealName(),teacher.getAvatar()));
+		webFeignService.updateNickName(teacher.getId(),teacher.getRealName(),"TEACHER");
+//		imFeignService.update(new ImUserModel(teacher.getId().toString(),teacher.getRealName(),teacher.getAvatar()));
 	}
 
 	@Override
@@ -664,7 +668,6 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 		teacher.setIdcardHandImg(idcardHandImg);
 		teacher.setUpdateTime(date);
 		teacherDao.update(teacher);
-
 		return true;
 	}
 

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -510,7 +510,7 @@
     </select>
     <sql id="findStudentAttendanceSql">
         <where>
-            cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
+            cs.del_flag_ = 0
             <if test="visitFlag != null">
                 <if test="visitFlag == 1">
                     AND sa.visit_flag_ = 1

+ 1 - 7
mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -280,7 +280,7 @@
     </sql>
     <sql id="queryTeacherAttendancesCondition">
         <where>
-            cs.del_flag_ = 0 AND cs.status_ = 'OVER' AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
+            cs.del_flag_ = 0
             <if test="search != null and search != ''">
                 AND (su.id_ = #{search} OR su.real_name_ LIKE CONCAT('%',#{search},'%') OR cs.id_ = #{search} OR cs.name_ LIKE CONCAT('%',#{search},'%'))
             </if>
@@ -317,12 +317,6 @@
             <if test="jobNature != null">
                 AND t.job_nature_ = #{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
-            <if test="attendanceStatus == 'ERR_ATTENDANCE'">
-                AND (ta.sign_in_status_ = 0 OR ta.sign_out_status_ = 0) AND (ta.sign_in_time_ IS NOT NULL OR ta.sign_out_time_ IS NOT NULL) AND ta.dispose_content_ IS NULL
-            </if>
-            <if test="attendanceStatus == 'NO_ATTENDANCE'">
-                AND ta.sign_out_time_ IS NULL AND ta.sign_in_time_ IS NULL AND ta.dispose_content_ IS NULL
-            </if>
         </where>
     </sql>
 

+ 3 - 0
mec-client-api/src/main/java/com/ym/mec/im/WebFeignService.java

@@ -18,4 +18,7 @@ public interface WebFeignService {
 	
 	@RequestMapping(value = "api/isPurchasedPracticeCourse")
 	Boolean isPurchasedPracticeCourse(@RequestParam("userId") Integer userId);
+
+	@RequestMapping(value = "api/updateNickName")
+	int updateNickName(@RequestParam("userId") Integer userId,@RequestParam("nickName") String nickName,@RequestParam("userType") String userType);
 }

+ 6 - 0
mec-client-api/src/main/java/com/ym/mec/im/fallback/WebFeignServiceFallback.java

@@ -3,6 +3,7 @@ package com.ym.mec.im.fallback;
 import org.springframework.stereotype.Component;
 
 import com.ym.mec.im.WebFeignService;
+import org.springframework.web.bind.annotation.RequestParam;
 
 @Component
 public class WebFeignServiceFallback implements WebFeignService {
@@ -21,4 +22,9 @@ public class WebFeignServiceFallback implements WebFeignService {
 	public Boolean isPurchasedPracticeCourse(Integer userId) {
 		return false;
 	}
+
+	@Override
+	public int updateNickName(Integer userId, String nickName,String userType) {
+		return 0;
+	}
 }

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/APIController.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.service.ImGroupService;
 import com.ym.mec.biz.service.PracticeGroupService;
 import com.ym.mec.biz.service.PracticeLessonApplyService;
 import com.ym.mec.common.controller.BaseController;
@@ -31,6 +32,8 @@ public class APIController extends BaseController {
 	
 	@Autowired
 	private PracticeGroupService practiceGroupService;
+	@Autowired
+	private ImGroupService imGroupService;
 
 	@GetMapping("/createCashAccount")
 	public Boolean createCashAccount(Integer userId) {
@@ -53,9 +56,15 @@ public class APIController extends BaseController {
 	public Object practiceSum() {
 		return succeed(practiceLessonApplyService.practiceSum());
 	}
+
 	@GetMapping("/isPurchasedPracticeCourse")
 	public Boolean isPurchasedPracticeCourse(Integer userId) {
 		return practiceGroupService.isPurchasedPracticeCourse(userId);
 	}
 
+	@GetMapping("/updateNickName")
+	public int updateNickName(Integer userId,String nickName,String userType) {
+		return imGroupService.updateNickName(userId,nickName,userType);
+	}
+
 }

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/ImGroupController.java

@@ -79,8 +79,8 @@ public class ImGroupController extends BaseController {
 
 	@ApiOperation("修改群成员信息")
 	@PostMapping(value = "/updateNickName")
-	public Object updateNickName(Integer userId,String nickName) {
-		return succeed(imGroupService.updateNickName(userId,nickName));
+	public Object updateNickName(Integer userId,String nickName,String userType) {
+		return succeed(imGroupService.updateNickName(userId,nickName,userType));
 	}
 
 	@ApiOperation("查询群成员列表")