Explorar o código

Merge branch 'pre'

dzx hai 1 ano
pai
achega
7de870fcd8

+ 8 - 1
src/main/java/com/xjrsoft/module/student/controller/BaseStudentInfoController.java

@@ -9,10 +9,13 @@ import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
+import com.xjrsoft.module.student.entity.BaseStudentUser;
 import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
+import com.xjrsoft.module.student.service.IStudentManagerService;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
 import com.xjrsoft.module.student.vo.MobileClassStatisticsVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -38,7 +41,7 @@ import javax.validation.Valid;
 @AllArgsConstructor
 public class BaseStudentInfoController {
 
-
+    private final IStudentManagerService studentManagerService;
     private final IBaseStudentSchoolRollService baseStudentSchoolRollService;
 
     @GetMapping(value = "/mobile-page")
@@ -46,6 +49,10 @@ public class BaseStudentInfoController {
     @SaCheckPermission("basestudentpost:detail")
     public RT<PageOutput<BaseStudentInfoPageVo>> mobilePage(@Valid BaseStudentInfoPageDto dto){
         Page<BaseStudentInfoPageVo> mobilePage = baseStudentSchoolRollService.getMobilePage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        for (BaseStudentInfoPageVo record : mobilePage.getRecords()) {
+            BaseStudentUser user = studentManagerService.getById(record.getId());
+            record.setAvatar(user.getAvatar());
+        }
         PageOutput<BaseStudentInfoPageVo> pageOutput = ConventPage.getPageOutput(mobilePage, BaseStudentInfoPageVo.class);
         return RT.ok(pageOutput);
     }

+ 5 - 1
src/main/java/com/xjrsoft/module/student/controller/StudentManagerController.java

@@ -90,6 +90,10 @@ public class StudentManagerController {
     public R page(@Valid BaseStudentUserPageDto dto) {
 
         IPage<BaseStudentUserPageVo> page = studentManagerService.getStudentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        for (BaseStudentUserPageVo record : page.getRecords()) {
+            BaseStudentUser user = studentManagerService.getById(record.getId());
+            record.setAvatar(user.getAvatar());
+        }
         PageOutput<BaseStudentUserPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentUserPageVo.class);
         return R.ok(pageOutput);
     }
@@ -198,7 +202,7 @@ public class StudentManagerController {
     @PostMapping("upload-image")
     @ApiOperation(value = "上传学生学籍照片")
     @SaCheckPermission("studentmanager:add")
-    public R uploadImage(@Valid Long userId, @RequestParam("file") MultipartFile file) throws IOException {
+    public R uploadImage(@RequestParam("file") MultipartFile file, @Valid @RequestParam Long userId) throws IOException {
         return R.ok(studentManagerService.uploadImage(userId, file));
     }
 

+ 1 - 1
src/main/java/com/xjrsoft/module/student/service/impl/StudentManagerServiceImpl.java

@@ -964,7 +964,7 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
     public Boolean uploadImage(Long userId, MultipartFile file) throws IOException {
         BaseStudentUser studentUser = studentbaseManagerBaseStudentUserMapper.selectById(userId);
         String[] imgSuffix = new String[]{"png", "jpg", "jpeg"};
-        String suffix = StringUtils.substringAfterLast(file.getName(), StringPool.DOT);
+        String suffix = StringUtils.substringAfterLast(file.getOriginalFilename(), StringPool.DOT);
         if (!Arrays.asList(imgSuffix).contains(suffix)) {
             throw new MyException("图片格式不正确!");
         }

+ 1 - 1
src/main/java/com/xjrsoft/module/system/controller/LoginController.java

@@ -92,7 +92,7 @@ public class LoginController {
     @ApiOperation(value = "登录", notes = "code")
     @XjrLog(value = "Code登录成功")
     public R findUserByCode(@RequestBody @Valid LoginByCodeDto dto) throws Exception {
-        return R.ok(loginService.loginByCode(dto));
+        return R.ok(loginService.findUserByCode(dto));
     }
 
     @PostMapping("/loginByCode")

+ 3 - 3
src/main/java/com/xjrsoft/module/system/service/impl/LoginServiceImpl.java

@@ -245,16 +245,16 @@ public class LoginServiceImpl implements ILoginService {
         if (weChatUserInfo == null) throw new MyException("code无效");
 
         LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(User::getUnionId, weChatUserInfo.getUnionid());
+        queryWrapper.eq(User::getOpenId, weChatUserInfo.getOpenid());
 
         User loginUser = userService.getOne(queryWrapper);
         if (loginUser == null) {//如果未找到用户,需要创建一个游客账号
             User user = new User();
-            user.setUnionId(weChatUserInfo.getUnionid());
+            user.setUnionId(weChatUserInfo.getOpenid());
             user.setOpenId(weChatUserInfo.getOpenid());
             user.setName("游客");
             user.setUserName(getUserName());
-            user.setCode(weChatUserInfo.getOpenid());
+            user.setCode(getUserName());
             //密码加密加盐存储到数据库
             user.setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
             userService.save(user);

+ 4 - 3
src/main/resources/mapper/student/BaseStudentMapper.xml

@@ -52,7 +52,7 @@
     </select>
     <select id="getStudentPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentUserPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentUserPageVo">
         SELECT t1.id,t4.name AS class_name,t5.name AS teacher_name,t1.name,t6.name AS gender_cn,t1.credential_number,
-        t1.mobile,t7.name AS archives_status_cn ,t8.name AS stduy_status_cn,t9.name AS student_type_cn,t1.avatar,t10.name as learn_status_cn FROM xjr_user t1
+        t1.mobile,t7.name AS archives_status_cn ,t8.name AS stduy_status_cn,t9.name AS student_type_cn,t10.name as learn_status_cn FROM xjr_user t1
         INNER JOIN base_student t2 ON t1.id = t2.user_id
         LEFT JOIN base_student_school_roll t3 ON t1.id = t3.user_id
         LEFT JOIN base_class t4 ON t4.id = t3.class_id
@@ -61,8 +61,9 @@
         LEFT JOIN xjr_dictionary_detail t7 ON t3.archives_status = t7.code AND t7.item_id = 2023000000000000029
         LEFT JOIN xjr_dictionary_detail t8 ON t3.stduy_status = t8.code AND t8.item_id = 2023000000000000030
         LEFT JOIN xjr_dictionary_detail t9 ON t3.student_type = t9.code AND t9.item_id = 2023000000000000028
-        LEFT JOIN xjr_dictionary_detail t10 ON t3.learn_status = t10.code AND t9.item_id = 1762024751192084482
+        LEFT JOIN xjr_dictionary_detail t10 ON t3.learn_status = t10.code AND t10.item_id = 1762024751192084482
         WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
+        and t3.archives_status = 'FB2901'
         <if test="dto.name != null and dto.name != ''">
             and t1.name like concat('%', #{dto.name},'%')
         </if>
@@ -87,7 +88,7 @@
                     order by t8.name
                 </if>
                 <if test="dto.field != null and dto.field == 'name'">
-                    order by t1.name
+                    order by t1.name asc
                 </if>
             </if>
             <if test="dto.order == 'descend'">

+ 0 - 1
src/main/resources/mapper/student/BaseStudentSchoolRollMapper.xml

@@ -22,7 +22,6 @@
             t2.gender,
             t10.name AS genderCn,
             t2.birth_date,
-            t2.avatar,
             t6.name AS nation,
             t3.archives_status AS archivesStatusCode,
             t3.stduy_status AS stduyStatusCode,