Ver código fonte

调试Bug修改

xiaof 3 anos atrás
pai
commit
5dc81a54bc

+ 4 - 0
src/main/java/cn/com/qmth/print/manage/controller/UserController.java

@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
+
 /**
  * @Date: 2021/11/16.
  */
@@ -64,6 +66,8 @@ public class UserController {
                 throw new StatusException("用户名不能修改");
             }
         }
+        user.setCreateTime(new Date());
+        user.setUpdateTime(new Date());
         return userService.saveOrUpdate(user);
     }
 }

+ 6 - 1
src/main/java/cn/com/qmth/print/manage/service/impl/ExamServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -37,7 +38,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamDao, ExamEntity> implements
     public List<ExamEntity> listByOrgId(Long orgId) {
         QueryWrapper<ExamEntity> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(ExamEntity::getOrgId, orgId).orderByDesc(ExamEntity::getId);
-        return null;
+        return this.list(queryWrapper);
     }
 
     @Transactional
@@ -52,6 +53,8 @@ public class ExamServiceImpl extends ServiceImpl<ExamDao, ExamEntity> implements
             // 删除用户绑定
             examUserRelationService.deleteByExamId(exam.getId());
         }
+        exam.setCreateTime(new Date());
+        exam.setUpdateTime(new Date());
         this.saveOrUpdate(exam);
 
         // 保存用户绑定
@@ -60,6 +63,8 @@ public class ExamServiceImpl extends ServiceImpl<ExamDao, ExamEntity> implements
             ExamUserRelationEntity examUserRelationEntity = new ExamUserRelationEntity();
             examUserRelationEntity.setExamId(exam.getId());
             examUserRelationEntity.setUserId(Long.valueOf(userId));
+            examUserRelationEntity.setCreateTime(new Date());
+            examUserRelationEntity.setUpdateTime(new Date());
             examUserRelationService.save(examUserRelationEntity);
         }
         return exam.getId();

+ 13 - 0
src/main/java/cn/com/qmth/print/manage/service/impl/ExamStudentServiceImpl.java

@@ -1,7 +1,9 @@
 package cn.com.qmth.print.manage.service.impl;
 
+import cn.com.qmth.print.manage.dao.ExamDao;
 import cn.com.qmth.print.manage.dao.ExamStudentDao;
 import cn.com.qmth.print.manage.dto.StudentDTO;
+import cn.com.qmth.print.manage.entity.ExamEntity;
 import cn.com.qmth.print.manage.entity.ExamStudentEntity;
 import cn.com.qmth.print.manage.enums.GroupType;
 import cn.com.qmth.print.manage.service.ExamStudentService;
@@ -17,13 +19,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.boot.core.exception.StatusException;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
+import org.checkerframework.checker.signature.qual.PolySignature;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.StringJoiner;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -33,6 +39,9 @@ import java.util.concurrent.atomic.AtomicLong;
 public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStudentEntity> implements
         ExamStudentService {
 
+    @Resource
+    private ExamDao examDao;
+
     @Override
     public ExamStudentEntity findByExamIdAndExamNumber(Long examId, String startNumber) {
         if (examId == null) {
@@ -104,6 +113,7 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
     @Transactional
     @Override
     public List<ExcelError> importStudents(Long examId, MultipartFile file) throws IOException {
+        ExamEntity examEntity = examDao.selectById(examId);
         List<ExamStudentEntity> studentList = new ArrayList<>();
         ExcelReader excelReader = new ExcelReader(StudentDTO.class);
         AtomicLong aLong = new AtomicLong(1L);
@@ -112,6 +122,7 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
                 StudentDTO dto = (StudentDTO) obj;
                 ExamStudentEntity examStudentEntity = new ExamStudentEntity();
                 examStudentEntity.setExamId(examId);
+                examStudentEntity.setOrgId(examEntity.getOrgId());
                 examStudentEntity.setExamNumber(dto.getExamNumber());
                 examStudentEntity.setStudentCode(dto.getStudentCode());
                 examStudentEntity.setName(dto.getName());
@@ -119,6 +130,8 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
                 examStudentEntity.setExamSite(dto.getExamSite());
                 examStudentEntity.setExamRoom(dto.getExamRoom());
                 examStudentEntity.setSortNo(aLong.getAndIncrement());
+                examStudentEntity.setCreateTime(new Date());
+                examStudentEntity.setUpdateTime(new Date());
                 studentList.add(examStudentEntity);
                 return null;
             } catch (RuntimeException e) {

+ 7 - 1
src/main/java/cn/com/qmth/print/manage/service/impl/OrgServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -73,7 +74,10 @@ public class OrgServiceImpl extends ServiceImpl<OrgDao, OrgEntity> implements Or
                 String accessKey = String.valueOf(map.get("accessKey"));
                 String accessSecret = String.valueOf(map.get("accessSecret"));
 
-                OrgEntity entity = orgEntities.stream().filter(m -> m.getCode().equals(code)).findFirst().get();
+                OrgEntity entity = null;
+                if(!CollectionUtils.isEmpty(orgEntities)){
+                    entity = orgEntities.stream().filter(m -> m.getCode().equals(code)).findFirst().get();
+                }
                 if (entity == null) {
                     entity = new OrgEntity();
                     // 中心的学校ID被占用,则使用自增ID
@@ -88,6 +92,8 @@ public class OrgServiceImpl extends ServiceImpl<OrgDao, OrgEntity> implements Or
                 entity.setAccessSecret(accessSecret);
                 entity.setLogoUrl(logo);
                 entity.setEnable(true);
+                entity.setCreateTime(new Date());
+                entity.setUpdateTime(new Date());
                 this.saveOrUpdate(entity);
             }
         }

+ 2 - 1
src/main/java/cn/com/qmth/print/manage/service/impl/UserServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.qmth.print.manage.service.impl;
 
 import cn.com.qmth.print.manage.dao.UserDao;
 import cn.com.qmth.print.manage.entity.UserEntity;
+import cn.com.qmth.print.manage.enums.RoleMeta;
 import cn.com.qmth.print.manage.service.UserService;
 import cn.com.qmth.print.manage.service.query.UserQuery;
 
@@ -38,7 +39,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
     @Override
     public List<UserEntity> listByEnable() {
         QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(UserEntity::isEnable, true);
+        queryWrapper.lambda().eq(UserEntity::getRole, RoleMeta.CHECKER).eq(UserEntity::isEnable, true);
         return this.list(queryWrapper);
     }
 

+ 4 - 4
src/main/java/cn/com/qmth/print/manage/utils/SolarUtils.java

@@ -3,6 +3,7 @@ package cn.com.qmth.print.manage.utils;
 import cn.com.qmth.print.manage.config.DictionaryConfig;
 import com.qmth.boot.tools.signature.SignatureEntity;
 import com.qmth.boot.tools.signature.SignatureType;
+import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -56,12 +57,11 @@ public class SolarUtils {
                 map.put("pageSize", String.valueOf(DEFAULT_PAGE_SIZE));
 
                 String result = HttpUtils.sendPost(postUrl, map, getHeaders(uri));
-                JSONObject jsonObject = new JSONObject();
-                List<Map> mapList = jsonObject.getJSONArray(result);
-                if (mapList.size() == 0) {
+                JSONArray jsonArray = JSONArray.fromObject(result);
+                if (jsonArray.size() == 0) {
                     break;
                 }
-                finalList.addAll(mapList);
+                finalList.addAll(jsonArray);
             }
         } catch (Exception e) {
             throw new RuntimeException("请求异常:" + e.getMessage());

+ 1 - 1
src/main/resources/application.properties

@@ -11,7 +11,7 @@ spring.jackson.time-zone=GMT+8
 #
 # ********** mybatis config **********
 #
-mybatis-plus.mapper-locations=classpath:mapper/*Mapper.xml
+mybatis-plus.mapper-locations=classpath:mapper/*Dao.xml
 mybatis-plus.configuration.map-underscore-to-camel-case=true
 #
 # ********** db config **********

+ 5 - 1
src/main/resources/mapper/ExamDao.xml

@@ -3,7 +3,11 @@
 <mapper namespace="cn.com.qmth.print.manage.dao.ExamDao">
     <select id="pageExam" resultType="cn.com.qmth.print.manage.vo.ExamVo">
         SELECT
-            pe.id, pe.enable, po.name orgName
+            pe.id,
+            pe.enable,
+            pe.group_type groupType,
+            pe.check_sort checkSort,
+            po.name orgName
         FROM
             pm_exam pe
                 LEFT JOIN

+ 0 - 0
src/main/resources/mapper/OrgMapper.xml → src/main/resources/mapper/OrgDao.xml