Explorar el Código

Merge remote-tracking branch 'origin/dev' into pre

dzx hace 11 meses
padre
commit
eb6cbb9c5b

+ 1 - 1
src/main/java/com/xjrsoft/module/evaluate/service/impl/EvaluateResultServiceImpl.java

@@ -123,7 +123,7 @@ public class EvaluateResultServiceImpl extends MPJBaseServiceImpl<EvaluateResult
                 .eq(EvaluateObject::getEvaluateManageId, dto.getEvaluateManageId())
                 .eq((dto.getBaseGradeId() != null && dto.getBaseGradeId() > 0), BaseClass::getGradeId, dto.getBaseGradeId())
                 .eq((dto.getClassId() != null && dto.getClassId() > 0), BaseClass::getId, dto.getClassId())
-                .eq(!ObjectUtil.isNotNull(dto.getTeacherId()), EvaluateObject::getObjectId, dto.getTeacherId())
+                .eq(ObjectUtil.isNotNull(dto.getTeacherId()), EvaluateObject::getObjectId, dto.getTeacherId())
                 .like((dto.getName() != null && !("").equals(dto.getName())), XjrUser::getName, dto.getName())
                 .disableSubLogicDel();
         List<ResultViewingPageVo> list = evaluateObjectMapper.selectJoinList(ResultViewingPageVo.class, evaluateObjectMPJLambdaWrapper);

+ 34 - 16
src/main/java/com/xjrsoft/module/job/StudentDropOutTask.java

@@ -2,13 +2,15 @@ package com.xjrsoft.module.job;
 
 import cn.hutool.extra.spring.SpringUtil;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import com.xjrsoft.common.enums.ArchivesStatusEnum;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.hikvision.service.IHikvisionDataService;
 import com.xjrsoft.module.hikvision.util.ApiUtil;
 import com.xjrsoft.module.personnel.entity.StundentFaceProcess;
-import com.xjrsoft.module.personnel.service.IFaceManagementService;
 import com.xjrsoft.module.personnel.service.IStundentFaceProcessService;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import lombok.extern.slf4j.Slf4j;
@@ -30,7 +32,7 @@ public class StudentDropOutTask {
     private IStundentFaceProcessService stundentFaceProcessService;
 
     @Autowired
-    private IFaceManagementService faceManagementService;
+    private IHikvisionDataService hikvisionDataService;
 
     @Scheduled(cron = "0 */30 * * * ?")
     public void execute() {
@@ -60,22 +62,38 @@ public class StudentDropOutTask {
             JsonParser parser = new JsonParser();
             for (StundentFaceProcess user : list) {
                 //删除海康人脸
-
-                JsonObject hikvisionResult = parser.parse(user.getHikvisionResult()).getAsJsonObject();
-                if(!hikvisionResult.get("msg").isJsonNull() && !"success".equals(hikvisionResult.get("msg").getAsString())){
-                    continue;
-                }
-                String faceId = hikvisionResult.get("data").getAsJsonObject().get("faceId").getAsString();
                 ApiUtil apiUtil = new ApiUtil();
-                String apiPath = "/api/resource/v1/face/single/delete";
-                JsonObject paramJson = new JsonObject();
-                paramJson.addProperty("faceId", faceId);
-                String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
+                String apiPath;
+                String faceId = null;
+                JsonObject paramJson;
+                if(user.getHikvisionResult() == null || !user.getHikvisionResult().startsWith("{\"code\":\"0\",\"msg\":\"success\"")){
+                    apiPath = "/api/resource/v1/person/condition/personInfo";
+                    paramJson = new JsonObject();
+                    paramJson.addProperty("paramName", "personId");
+                    JsonArray paramValue = new JsonArray();
+                    paramValue.add(hikvisionDataService.getHikvisionIdBySourceId(user.getUserId().toString()));
+                    paramJson.add("paramValue", paramValue);
+                    String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
+                    JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
+                    if(resultJson.get("code").getAsInt() == 0 && "success".equals(resultJson.get("msg").getAsString())){
+                        JsonElement data = resultJson.get("data").getAsJsonObject().get("list").getAsJsonArray().get(0);
+                        faceId = data.getAsJsonObject().get("personPhoto").getAsJsonArray().get(0).getAsJsonObject().get("personPhotoIndexCode").getAsString();
+                    }
+                }else{
+                    JsonObject hikvisionResult = parser.parse(user.getHikvisionResult()).getAsJsonObject();
+                    faceId = hikvisionResult.get("data").getAsJsonObject().get("faceId").getAsString();
+                }
+
+                if(faceId != null){
+                    apiPath = "/api/resource/v1/face/single/delete";
+                    paramJson = new JsonObject();
+                    paramJson.addProperty("faceId", faceId);
+                    String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
 
-                JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
-                if(resultJson.get("code").getAsInt() == 0){
-                    stundentFaceProcessService.removeById(user);
-                    faceManagementService.clearRegisterBase64ByUserId(user.getUserId());
+                    JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
+                    if(resultJson.get("code").getAsInt() == 0){
+                        stundentFaceProcessService.removeById(user);
+                    }
                 }
             }
 

+ 22 - 0
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -85,6 +85,7 @@ import com.xjrsoft.module.organization.vo.UserStudentInfoVo;
 import com.xjrsoft.module.organization.vo.UserStudentVo;
 import com.xjrsoft.module.organization.vo.UserVo;
 import com.xjrsoft.module.oss.factory.OssFactory;
+import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.entity.BaseStudentUser;
 import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
@@ -231,6 +232,16 @@ public class UserController {
                     .leftJoin(DictionaryDetail.class, "d1", DictionaryDetail::getCode, BaseTeacher::getEmployWay)
                     .leftJoin(DictionaryDetail.class, "d2", DictionaryDetail::getCode, BaseTeacher::getEmployType)
                     .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId);
+
+            if(ObjectUtil.isNotNull(dto.getUserType())) {
+                if (dto.getUserType() == 2) {
+                    queryUser.eq(BaseTeacher::getIsNormal, 1);
+                }
+                if (dto.getUserType() == 3) {
+                    queryUser.leftJoin(BaseStudent.class, BaseStudent::getUserId, User::getId)
+                            .eq(BaseStudent::getIsNormal, 1);
+                }
+            }
             IPage<UserPageVo> page = userService.selectJoinListPage(ConventPage.getPage(dto), UserPageVo.class, queryUser);
             for (UserPageVo record : page.getRecords()) {
                 record.setGenderCn(GenderDictionaryEnum.getValue(record.getGender()));
@@ -283,6 +294,17 @@ public class UserController {
                             .leftJoin(DictionaryDetail.class, "d1", DictionaryDetail::getCode, BaseTeacher::getEmployWay)
                             .leftJoin(DictionaryDetail.class, "d2", DictionaryDetail::getCode, BaseTeacher::getEmployType)
                             .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId);
+
+            if(ObjectUtil.isNotNull(dto.getUserType())) {
+                if (dto.getUserType() == 2) {
+                    queryUser.eq(BaseTeacher::getIsNormal, 1);
+                }
+                if (dto.getUserType() == 3) {
+                    queryUser.leftJoin(BaseStudent.class, BaseStudent::getUserId, User::getId)
+                            .eq(BaseStudent::getIsNormal, 1);
+                }
+            }
+
             IPage<UserPageVo> page = userService.selectJoinListPage(ConventPage.getPage(dto), UserPageVo.class,queryUser);
             for (UserPageVo record : page.getRecords()) {
                 record.setGenderCn(GenderDictionaryEnum.getValue(record.getGender()));

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

@@ -21,6 +21,7 @@ import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.enums.EvaluateTypeEnum;
 import com.xjrsoft.common.enums.ScoreTypeEnum;
+import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.common.utils.excel.ExcelMergeUtil;
@@ -148,6 +149,9 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
     @Override
     public BaseStudentAssessmentInspectionVo getInfo(Long id) {
         BaseStudentAssessmentInspectionVo result = assessmentInspectionMapper.getInfo(id);
+        if(result == null){
+           throw new MyException("该记录已被作废");
+        }
         // 获取班级信息
         List<BaseStudentAssessmentClassListVo> baseStudentAssessmentClassListVos = assessmentClassRelationMapper.selectJoinList(BaseStudentAssessmentClassListVo.class,
                 MPJWrappers.<BaseStudentAssessmentClassRelation>lambdaJoin()
@@ -863,7 +867,7 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
 
             columnNumber ++;
             cell = dataRow.createCell(columnNumber);
-            cell.setCellValue(pageVo.getStudentNum().toString());
+            cell.setCellValue(pageVo.getStudentNum()==null?"":pageVo.getStudentNum().toString());
             cell.setCellStyle(cellStyle);
 
             columnNumber ++;

+ 9 - 0
src/main/resources/mapper/organization/UserMapper.xml

@@ -7,6 +7,12 @@
         SELECT DISTINCT t1.*,t3.name AS gender_cn FROM xjr_user t1
         INNER JOIN xjr_user_role_relation t2 ON t2.user_id = t1.id
         LEFT JOIN xjr_dictionary_detail t3 ON t1.gender = t3.code
+        <if test="dto.roleId != null and dto.roleId=='2'">
+            INNER JOIN base_teacher t4 on t1.id=t4.user_id
+        </if>
+        <if test="dto.roleId != null and dto.roleId=='3'">
+            INNER JOIN base_student t4 on t1.id=t4.user_id
+        </if>
         WHERE t1.delete_mark = 0
         <if test="dto.keyword != null and dto.keyword !=''">
             and (t1.name like concat('%', #{dto.keyword}, '%') or t1.mobile like concat('%', #{dto.keyword}, '%'))
@@ -14,6 +20,9 @@
         <if test="dto.roleId != null">
             and t2.role_id = #{dto.roleId}
         </if>
+        <if test="dto.roleId != null and (dto.roleId=='2' or dto.roleId=='3')">
+            and t4.delete_mark = 0 AND t4.is_normal = 1
+        </if>
     </select>
     <select id="getInfosByParam" parameterType="com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto" resultType="com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo">
         SELECT t1.id, t1.name as student_name, t1.enabled_mark, t1.credential_number, t4.name AS class_name,t1.mobile,

+ 38 - 15
src/test/java/com/xjrsoft/module/job/StudentDropOutTaskTest.java

@@ -1,11 +1,14 @@
 package com.xjrsoft.module.job;
 
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import com.xjrsoft.XjrSoftApplication;
 import com.xjrsoft.common.enums.ArchivesStatusEnum;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.hikvision.service.IHikvisionDataService;
 import com.xjrsoft.module.hikvision.util.ApiUtil;
 import com.xjrsoft.module.personnel.entity.StundentFaceProcess;
 import com.xjrsoft.module.personnel.service.IStundentFaceProcessService;
@@ -29,36 +32,56 @@ class StudentDropOutTaskTest {
     @Autowired
     private IStundentFaceProcessService stundentFaceProcessService;
 
+    @Autowired
+    private IHikvisionDataService hikvisionDataService;
+
     @Test
     void test(){
-        Long id = 1783747887750492160L;
+        Long id = 1783747887754686465L;
         List<StundentFaceProcess> list = stundentFaceProcessService.list(
                 new MPJLambdaWrapper<StundentFaceProcess>()
                         .select(StundentFaceProcess::getId)
                         .select(StundentFaceProcess.class, x -> VoToColumnUtil.fieldsToColumns(StundentFaceProcess.class).contains(x.getProperty()))
                         .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, StundentFaceProcess::getUserId)
                         .ne(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901)
-                        .isNotNull(StundentFaceProcess::getHikvisionResult)
+                        //.isNotNull(StundentFaceProcess::getHikvisionResult)
                         .eq(StundentFaceProcess::getUserId, id)
         );
         JsonParser parser = new JsonParser();
         for (StundentFaceProcess user : list) {
             //删除海康人脸
-
-            JsonObject hikvisionResult = parser.parse(user.getHikvisionResult()).getAsJsonObject();
-            if(!hikvisionResult.get("msg").isJsonNull() && !"success".equals(hikvisionResult.get("msg").getAsString())){
-                continue;
-            }
-            String faceId = hikvisionResult.get("data").getAsJsonObject().get("faceId").getAsString();
             ApiUtil apiUtil = new ApiUtil();
-            String apiPath = "/api/resource/v1/face/single/delete";
-            JsonObject paramJson = new JsonObject();
-            paramJson.addProperty("faceId", faceId);
-            String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
+            String apiPath;
+            String faceId = null;
+            JsonObject paramJson;
+            if(user.getHikvisionResult() == null || !user.getHikvisionResult().startsWith("{\"code\":\"0\",\"msg\":\"success\"")){
+                apiPath = "/api/resource/v1/person/condition/personInfo";
+                paramJson = new JsonObject();
+                paramJson.addProperty("paramName", "personId");
+                JsonArray paramValue = new JsonArray();
+                paramValue.add(hikvisionDataService.getHikvisionIdBySourceId(user.getUserId().toString()));
+                paramJson.add("paramValue", paramValue);
+                String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
+                JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
+                if(resultJson.get("code").getAsInt() == 0 && "success".equals(resultJson.get("msg").getAsString())){
+                    JsonElement data = resultJson.get("data").getAsJsonObject().get("list").getAsJsonArray().get(0);
+                    faceId = data.getAsJsonObject().get("personPhoto").getAsJsonArray().get(0).getAsJsonObject().get("personPhotoIndexCode").getAsString();
+                }
+            }else{
+                JsonObject hikvisionResult = parser.parse(user.getHikvisionResult()).getAsJsonObject();
+                faceId = hikvisionResult.get("data").getAsJsonObject().get("faceId").getAsString();
+            }
+
+            if(faceId != null){
+                apiPath = "/api/resource/v1/face/single/delete";
+                paramJson = new JsonObject();
+                paramJson.addProperty("faceId", faceId);
+                String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
 
-            JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
-            if(resultJson.get("code").getAsInt() == 0){
-                stundentFaceProcessService.removeById(user);
+                JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
+                if(resultJson.get("code").getAsInt() == 0){
+                    stundentFaceProcessService.removeById(user);
+                }
             }
         }
     }