xiaof 3 years ago
parent
commit
e3538cc40f
25 changed files with 152 additions and 94 deletions
  1. 4 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ThirdObjectDto.java
  2. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/SyncDataParam.java
  3. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/PrintPlanResult.java
  4. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamPrintPlan.java
  5. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamDetailCourseMapper.java
  6. 1 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPrintPlanMapper.java
  7. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskMapper.java
  8. 2 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ClientService.java
  9. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPrintPlanService.java
  10. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskService.java
  11. 14 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java
  12. 33 20
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java
  13. 6 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPrintPlanServiceImpl.java
  14. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  15. 2 2
      distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml
  16. 5 0
      distributed-print-business/src/main/resources/mapper/ExamPrintPlanMapper.xml
  17. 1 1
      distributed-print-business/src/main/resources/mapper/ExamTaskDetailMapper.xml
  18. 36 37
      distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml
  19. 3 7
      distributed-print/src/main/java/com/qmth/distributed/print/api/ClientController.java
  20. 3 3
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPrintPlanSyncController.java
  21. 1 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java
  22. 3 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/SysPrivilegeMapper.java
  23. 2 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysPrivilegeService.java
  24. 5 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysPrivilegeServiceImpl.java
  25. 16 2
      teachcloud-common/src/main/resources/mapper/SysPrivilegeMapper.xml

+ 4 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ThirdObjectDto.java

@@ -1,10 +1,14 @@
 package com.qmth.distributed.print.business.bean.dto;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+
 /**
  * @Date: 2021/3/29.
  */
 public class ThirdObjectDto {
 
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long thirdRelateId;
     private String thirdRelateName;
 

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/SyncDataParam.java

@@ -13,7 +13,7 @@ public class SyncDataParam {
 
     private String thirdRelateName;
 
-    private List<ExamPrintPlan> list;
+    private List<Long> list;
 
     public Long getThirdRelateId() {
         return thirdRelateId;
@@ -31,11 +31,11 @@ public class SyncDataParam {
         this.thirdRelateName = thirdRelateName;
     }
 
-    public List<ExamPrintPlan> getList() {
+    public List<Long> getList() {
         return list;
     }
 
-    public void setList(List<ExamPrintPlan> list) {
+    public void setList(List<Long> list) {
         this.list = list;
     }
 }

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/PrintPlanResult.java

@@ -83,7 +83,7 @@ public class PrintPlanResult {
     private Long thirdRelateId;
 
     @ApiModelProperty("第三方系统关联考试名称")
-    private Long thirdRelateName;
+    private String thirdRelateName;
 
     @ApiModelProperty("是否同步成功")
     private Boolean syncStatus;
@@ -248,11 +248,11 @@ public class PrintPlanResult {
         this.thirdRelateId = thirdRelateId;
     }
 
-    public Long getThirdRelateName() {
+    public String getThirdRelateName() {
         return thirdRelateName;
     }
 
-    public void setThirdRelateName(Long thirdRelateName) {
+    public void setThirdRelateName(String thirdRelateName) {
         this.thirdRelateName = thirdRelateName;
     }
 

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamPrintPlan.java

@@ -103,7 +103,7 @@ public class ExamPrintPlan extends BaseEntity implements Serializable {
     private Long thirdRelateId;
 
     @TableField("third_relate_name")
-    private Long thirdRelateName;
+    private String thirdRelateName;
 
     @TableField("sync_status")
     private Boolean syncStatus;
@@ -216,11 +216,11 @@ public class ExamPrintPlan extends BaseEntity implements Serializable {
         this.thirdRelateId = thirdRelateId;
     }
 
-    public Long getThirdRelateName() {
+    public String getThirdRelateName() {
         return thirdRelateName;
     }
 
-    public void setThirdRelateName(Long thirdRelateName) {
+    public void setThirdRelateName(String thirdRelateName) {
         this.thirdRelateName = thirdRelateName;
     }
 

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamDetailCourseMapper.java

@@ -24,7 +24,7 @@ public interface ExamDetailCourseMapper extends BaseMapper<ExamDetailCourse> {
 
     List<BasicCourse> listCoursesByPrintPlanId(@Param("param") String param, @Param("printPlanIdList") List<Long> printPlanIdList);
 
-    List<String> listPaperNumberByPrintPlanId(@Param("param") String param, @Param("printPlanId") List<Long> printPlanIdList);
+    List<String> listPaperNumberByPrintPlanId(@Param("param") String param, @Param("printPlanIdList") List<Long> printPlanIdList);
 
     List<ExamDetailCourse> listByPrintPlanIdAndCourseCodeAndPaperNumber(@Param("schoolId") Long schoolId, @Param("printPlanId") Long printPlanId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber);
 

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPrintPlanMapper.java

@@ -32,6 +32,7 @@ public interface ExamPrintPlanMapper extends BaseMapper<ExamPrintPlan> {
 
     IPage<PrintPlanResult> findPrintPlanSyncPage(@Param("iPage") Page<PrintPlanResult> iPage,
                                              @Param("schoolId") Long schoolId,
+                                             @Param("status") String[] status,
                                              @Param("printPlanId") Long printPlanId,
                                              @Param("startTime") Long startTime,
                                              @Param("endTime") Long endTime,

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskMapper.java

@@ -29,7 +29,7 @@ public interface ExamTaskMapper extends BaseMapper<ExamTask> {
 
     List<BlurryUserDto> listUser(@Param("schoolId") Long schoolId, @Param("param") String param);
 
-    IPage<ExamTaskDto> listTaskApply(Page<ExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("auditStatus") String auditStatus, @Param("reviewStatus") String reviewStatus, @Param("cardRuleId") Long cardRuleId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") Long userId, @Param("orgIds") Set<Long> orgIds, @Param("userName") String userName);
+    IPage<ExamTaskDto> listTaskApply(Page<ExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("auditStatus") String auditStatus, @Param("cardRuleId") Long cardRuleId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userId") Long userId, @Param("orgIds") Set<Long> orgIds, @Param("userName") String userName);
 
     IPage<ExamTaskDto> listTaskReviewUnaudited(Page<ExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId, @Param("cardRuleId") Long cardRuleId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("orgIds") Set<Long> orgIds, @Param("startCreateTime") Long startCreateTime, @Param("endCreateTime") Long endCreateTime, @Param("createName") String createName, @Param("currentUserId") Long currentUserId);
 

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ClientService.java

@@ -44,4 +44,6 @@ public interface ClientService {
     IPage<ClientPrintStatisticsDto> listClientPrintStatistics(String orgId, String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber, Integer pageNumber, Integer pageSize);
 
     ClientPrintStatisticsTotalDto clientStatisticsTotalData(String orgId, String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber);
+
+    void checkPrivilege(Long id);
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPrintPlanService.java

@@ -94,5 +94,5 @@ public interface ExamPrintPlanService extends IService<ExamPrintPlan> {
 
     List<ThirdObjectDto> printSyncPlan(Long schoolId);
 
-    void syncDataCloudBatch(String printPlanIds);
+    void syncDataCloudBatch(SyncDataParam syncDataParam);
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskService.java

@@ -59,7 +59,7 @@ public interface ExamTaskService extends IService<ExamTask> {
 
     List<ExamTask> saveBatch(ExamTask task);
 
-    IPage<ExamTaskDto> listTaskApply(String auditStatus, String reviewStatus, Long cardRuleId, String courseCode, String paperNumber, Long startTime, Long endTime, String userName, Integer pageNumber, Integer pageSize);
+    IPage<ExamTaskDto> listTaskApply(String auditStatus, Long cardRuleId, String courseCode, String paperNumber, Long startTime, Long endTime, String userName, Integer pageNumber, Integer pageSize);
 
     IPage<ExamTaskDto> listTaskReviewUnaudited(String courseCode, String paperNumber, Long userId, Long cardRuleId, Long startTime, Long endTime, Long startCreateTime, Long endCreateTime, String createName, Integer pageNumber, Integer pageSize);
 

+ 14 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java

@@ -11,8 +11,10 @@ import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
+import com.qmth.teachcloud.common.entity.SysPrivilege;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.service.BasicAttachmentService;
+import com.qmth.teachcloud.common.service.SysPrivilegeService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.ExcelUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
@@ -64,6 +66,9 @@ public class ClientServiceImpl implements ClientService {
     @Resource
     TeachcloudCommonService teachcloudCommonService;
 
+    @Autowired
+    private SysPrivilegeService sysPrivilegeService;
+
     @Override
     public IPage<ClientExamTaskDto> listTryTask(String machineCode, Long orgId, Long printPlanId, String courseCode, String paperNumber, Boolean isTry, Boolean isPass, Integer pageNumber, Integer pageSize) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
@@ -578,6 +583,15 @@ public class ClientServiceImpl implements ClientService {
         return examPrintPlanService.clientStatisticsTotalData(printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber);
     }
 
+    @Override
+    public void checkPrivilege(Long userId) {
+       List<SysPrivilege> sysPrivileges = sysPrivilegeService.getClientUrlByUserId(userId);
+        long count = sysPrivileges.stream().filter(m -> "客户端".equals(m.getName()) && "client".equals(m.getUrl())).count();
+        if(count == 0){
+            throw ExceptionResultEnum.ERROR.exception("用户没有权限,无法登录");
+        }
+    }
+
     /**
      * 根据考场生成试卷map
      *

+ 33 - 20
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java

@@ -87,7 +87,7 @@ public class DataSyncServiceImpl implements DataSyncService {
         List<ExamPrintPlan> examPrintPlans = examPrintPlanService.list(queryWrapper);
         if (!CollectionUtils.isEmpty(examPrintPlans)) {
             for (ExamPrintPlan examPrintPlan : examPrintPlans) {
-                executors.execute(syncData(examPrintPlan, null));
+                executors.execute(syncData(examPrintPlan, null, examPrintPlan.getName()));
             }
         }
     }
@@ -104,43 +104,52 @@ public class DataSyncServiceImpl implements DataSyncService {
         if (examPrintPlan == null) {
             throw ExceptionResultEnum.ERROR.exception("印刷计划数据异常");
         }
-        if (!PrintPlanStatusEnum.END.equals(examPrintPlan.getStatus())) {
-            throw ExceptionResultEnum.ERROR.exception("印刷计划未结束,不能同步数据");
+        if (!PrintPlanStatusEnum.END.equals(examPrintPlan.getStatus()) && !PrintPlanStatusEnum.PRINT_FINISH.equals(examPrintPlan.getStatus())) {
+            throw ExceptionResultEnum.ERROR.exception("印刷计划未打印完成或者未结束,不能同步数据");
         }
         Long relateId = Objects.isNull(thirdRelateId) ? examPrintPlan.getThirdRelateId() : thirdRelateId;
-        executors.execute(syncData(examPrintPlan, relateId));
+        String thirdRelateName = Objects.isNull(examPrintPlan.getThirdRelateId()) ? examPrintPlan.getName() : examPrintPlan.getThirdRelateName();
+        executors.execute(syncData(examPrintPlan, relateId, thirdRelateName));
 
     }
 
     @Override
     public void syncDataMerge(SyncDataParam syncDataParam) {
-        List<ExamPrintPlan> printPlans = syncDataParam.getList();
-        if(CollectionUtils.isEmpty(printPlans)){
-            return;
+        List<Long> printPlans = syncDataParam.getList();
+        if (CollectionUtils.isEmpty(printPlans)) {
+            throw ExceptionResultEnum.ERROR.exception("请选择需要合并的印刷任务");
+        }
+
+        if(Objects.isNull(syncDataParam.getThirdRelateId()) || Objects.isNull(syncDataParam.getThirdRelateName())){
+            throw ExceptionResultEnum.ERROR.exception("考试ID、考试名称至少填一个");
         }
 
         // todo 校验印刷计划是否完成
-        if(syncDataParam.getThirdRelateId() == null){
+        if (syncDataParam.getThirdRelateId() == null) {
             Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
             String time = String.valueOf(System.currentTimeMillis());
-            ExamPrintPlan examPrintPlan = printPlans.stream().max(Comparator.comparingLong(ExamPrintPlan::getExamEndTime)).get();
+            QueryWrapper<ExamPrintPlan> printPlanQueryWrapper = new QueryWrapper<>();
+            printPlanQueryWrapper.lambda().in(ExamPrintPlan::getId, syncDataParam.getList());
+            List<ExamPrintPlan> examPrintPlans = examPrintPlanService.list(printPlanQueryWrapper);
+            ExamPrintPlan examPrintPlan = examPrintPlans.stream().max(Comparator.comparingLong(ExamPrintPlan::getExamEndTime)).get();
             String examTime = DateUtil.format(new Date(examPrintPlan.getExamEndTime()), DATE_FORMAT);
             syncDataParam.setThirdRelateId(getExamId(schoolId, time, syncDataParam.getThirdRelateName(), examTime));
         }
 
-        for (ExamPrintPlan printPlan : printPlans) {
-            executors.execute(syncData(printPlan, syncDataParam.getThirdRelateId()));
+        for (Long printPlanId : printPlans) {
+            ExamPrintPlan printPlan = examPrintPlanService.getById(printPlanId);
+            executors.execute(syncData(printPlan, syncDataParam.getThirdRelateId(), syncDataParam.getThirdRelateName()));
         }
     }
 
-    private TimerTask syncData(ExamPrintPlan examPrintPlan, Long thirdRelateId) {
+    private TimerTask syncData(ExamPrintPlan examPrintPlan, Long thirdRelateId, String thirdRelateName) {
         return new TimerTask() {
             @Override
             public void run() {
                 SysConfig sysConfig = sysConfigService.getByKey("sys.sync.enable");
                 if (sysConfig != null && "true".equals(sysConfig.getConfigValue())) {
                     TBSyncTask syncTask = tbSyncTaskService.saveTask(examPrintPlan);
-                    doSyncCore(examPrintPlan, thirdRelateId, syncTask);
+                    doSyncCore(examPrintPlan, thirdRelateId, thirdRelateName, syncTask);
                 }
             }
         };
@@ -149,14 +158,15 @@ public class DataSyncServiceImpl implements DataSyncService {
     /**
      * 同步核心方法
      *
+     * @param thirdRelateName
      * @param syncTask
      */
     @Transactional
-    public void doSyncCore(ExamPrintPlan examPrintPlan, Long thirdRelateId, TBSyncTask syncTask) {
+    public void doSyncCore(ExamPrintPlan examPrintPlan, Long thirdRelateId, String thirdRelateName, TBSyncTask syncTask) {
         UpdateWrapper<ExamPrintPlan> updateWrapper = new UpdateWrapper<>();
         try {
-            if (!PrintPlanStatusEnum.END.equals(examPrintPlan.getStatus())) {
-                throw ExceptionResultEnum.ERROR.exception("印刷计划未结束,不能同步数据");
+            if (!PrintPlanStatusEnum.END.equals(examPrintPlan.getStatus()) && !PrintPlanStatusEnum.PRINT_FINISH.equals(examPrintPlan.getStatus())) {
+                throw ExceptionResultEnum.ERROR.exception("印刷计划未打印完成或者未结束,不能同步数据");
             }
             // 校验同步url
             validatUrl();
@@ -165,7 +175,7 @@ public class DataSyncServiceImpl implements DataSyncService {
             tbSyncTaskService.update(tbSyncTaskUpdateWrapper);
 
             // 同步计划 -> 对应云阅卷考试
-            ExamPrintPlan printPlan = examSave(examPrintPlan, thirdRelateId);
+            ExamPrintPlan printPlan = examSave(examPrintPlan, thirdRelateId, thirdRelateName);
             syncTask.setThirdRelateId(printPlan.getThirdRelateId());
             // 考试同步成功,才能同步考生和题卡
             if (Objects.nonNull(printPlan.getThirdRelateId())) {
@@ -211,19 +221,22 @@ public class DataSyncServiceImpl implements DataSyncService {
      * 创建考试
      *
      * @param examPrintPlan
+     * @param thirdRelateName
      * @return
      */
-    public ExamPrintPlan examSave(ExamPrintPlan examPrintPlan, Long thirdRelateId) {
+    public ExamPrintPlan examSave(ExamPrintPlan examPrintPlan, Long thirdRelateId, String thirdRelateName) {
         try {
             if (Objects.isNull(thirdRelateId)) {
-
                 String code = String.valueOf(examPrintPlan.getId());
                 String name = examPrintPlan.getName();
                 String examTime = DateUtil.format(new Date(examPrintPlan.getExamEndTime()), DATE_FORMAT);
                 thirdRelateId = getExamId(examPrintPlan.getSchoolId(), code, name, examTime);
             }
             UpdateWrapper<ExamPrintPlan> updateWrapper = new UpdateWrapper<>();
-            updateWrapper.lambda().set(ExamPrintPlan::getThirdRelateId, thirdRelateId).set(ExamPrintPlan::getSyncStatus, null).eq(ExamPrintPlan::getId, examPrintPlan.getId());
+            updateWrapper.lambda().set(ExamPrintPlan::getThirdRelateId, thirdRelateId)
+                    .set(ExamPrintPlan::getThirdRelateName, thirdRelateName)
+                    .set(ExamPrintPlan::getSyncStatus, null)
+                    .eq(ExamPrintPlan::getId, examPrintPlan.getId());
             examPrintPlanService.update(updateWrapper);
             return examPrintPlanService.getById(examPrintPlan.getId());
         } catch (Exception e) {

+ 6 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPrintPlanServiceImpl.java

@@ -104,7 +104,8 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
     @Override
     public IPage<PrintPlanResult> printPlanSyncPage(Long schoolId, Long printPlanId, Long startTime, Long endTime, int pageNumber, int pageSize) {
         Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
-        IPage<PrintPlanResult> page = examPrintPlanMapper.findPrintPlanSyncPage(new Page<>(pageNumber, pageSize), schoolId, printPlanId, startTime, endTime, orgIds);
+        String[] status = {PrintPlanStatusEnum.PRINT_FINISH.name(), PrintPlanStatusEnum.END.name()};
+        IPage<PrintPlanResult> page = examPrintPlanMapper.findPrintPlanSyncPage(new Page<>(pageNumber, pageSize), schoolId,status, printPlanId, startTime, endTime, orgIds);
         List<PrintPlanResult> list = page.getRecords();
         for (PrintPlanResult printPlanResult : list) {
             List<Map> variableContent = JSONObject.parseArray(printPlanResult.getVariableContentTemp(), Map.class);
@@ -434,10 +435,10 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
     }
 
     @Override
-    public void syncDataCloudBatch(String printPlanIds) {
-        String[] ids = printPlanIds.split(",");
-        for (String id : ids) {
-            dataSyncService.syncDataCloud(Long.valueOf(id), null);
+    public void syncDataCloudBatch(SyncDataParam syncDataParam) {
+        List<Long> ids = syncDataParam.getList();
+        for (Long id : ids) {
+            dataSyncService.syncDataCloud(id, null);
         }
     }
 

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -596,13 +596,13 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     }
 
     @Override
-    public IPage<ExamTaskDto> listTaskApply(String auditStatus, String reviewStatus, Long cardRuleId, String
+    public IPage<ExamTaskDto> listTaskApply(String auditStatus, Long cardRuleId, String
             courseCode, String paperNumber, Long startTime, Long endTime, String userName, Integer pageNumber, Integer pageSize) {
         userName = SystemConstant.translateSpecificSign(userName);
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
-        IPage<ExamTaskDto> examTaskDtoIPage = this.baseMapper.listTaskApply(new Page<>(pageNumber, pageSize), schoolId, auditStatus, reviewStatus, cardRuleId, courseCode, paperNumber, startTime, endTime, sysUser.getId(), orgIds, userName);
+        IPage<ExamTaskDto> examTaskDtoIPage = this.baseMapper.listTaskApply(new Page<>(pageNumber, pageSize), schoolId, auditStatus, cardRuleId, courseCode, paperNumber, startTime, endTime, sysUser.getId(), orgIds, userName);
         return examTaskDtoIPage;
     }
 

+ 2 - 2
distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml

@@ -135,7 +135,7 @@
                 AND det.school_id = #{schoolId}
             </if>
             <if test="printPlanIdList != null and printPlanIdList.size() > 0">
-                AND det.print_plan_id = IN
+                AND det.print_plan_id IN
                 <foreach collection="printPlanIdList" item="item" index="index" open="(" separator="," close=")">
                     #{item}
                 </foreach>
@@ -214,7 +214,7 @@
                 AND det.school_id = #{schoolId}
             </if>
             <if test="printPlanIdList != null and printPlanIdList.size() > 0">
-                AND det.print_plan_id = IN
+                AND det.print_plan_id IN
                 <foreach collection="printPlanIdList" item="item" index="index" open="(" separator="," close=")">
                     #{item}
                 </foreach>

+ 5 - 0
distributed-print-business/src/main/resources/mapper/ExamPrintPlanMapper.xml

@@ -121,6 +121,10 @@
         LEFT JOIN
         sys_user b on a.create_id = b.id
         <where>
+            AND a.status IN
+            <foreach collection="status" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
             <if test="schoolId != null and schoolId > 0">
                 and a.school_id = #{schoolId}
             </if>
@@ -525,6 +529,7 @@
             exam_print_plan
         WHERE
             school_id = #{schoolId}
+            and third_relate_id is not null
         ORDER BY third_relate_id DESC
     </select>
 

+ 1 - 1
distributed-print-business/src/main/resources/mapper/ExamTaskDetailMapper.xml

@@ -80,7 +80,7 @@
                 </if>
             </if>
             <if test="printPlanIdList != null and printPlanIdList.size() > 0">
-                and a.print_plan_id = IN
+                and a.print_plan_id IN
                 <foreach collection="printPlanIdList" item="item" index="index" open="(" separator="," close=")">
                     #{item}
                 </foreach>

+ 36 - 37
distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml

@@ -196,28 +196,25 @@
                 and a.school_id = #{schoolId}
             </if>
             <if test="auditStatus != null">
-                and a.auditStatus = #{auditStatus}
-            </if>
-            <if test="reviewStatus != null and status != ''">
-                and a.reviewStatus = #{reviewStatus}
+                and e.status = #{auditStatus}
             </if>
             <if test="cardRuleId != null and cardRuleId != ''">
-                and a.cardRuleId = #{cardRuleId}
+                and a.card_rule_id = #{cardRuleId}
             </if>
             <if test="courseCode != null and courseCode != ''">
-                and a.courseCode = #{courseCode}
+                and a.course_code = #{courseCode}
             </if>
             <if test="paperNumber != null and paperNumber != ''">
-                and a.paperNumber = #{paperNumber}
+                and a.paper_number = #{paperNumber}
             </if>
             <if test="startTime != null and startTime != ''">
-                and a.startTime &gt;= #{startTime}
+                and a.start_time &gt;= #{startTime}
             </if>
             <if test="endTime != null and endTime != ''">
-                and a.startTime &lt;= #{endTime}
+                and a.start_time &lt;= #{endTime}
             </if>
             <if test="userName != null and userName != ''">
-                and a.userName like concat('%',#{userName},'%')
+                and c.real_name like concat('%',#{userName},'%')
             </if>
         </where>
         order by a.create_time desc
@@ -621,43 +618,45 @@
     <select id="listClientExamTaskPage"
             resultType="com.qmth.distributed.print.business.bean.dto.ClientExamTaskDto">
         SELECT
-        distinct a.school_id schoolId,
-        a.id printPlanId,
-        a.name printPlanName,
-        c.course_code courseCode,
-        c.course_name courseName,
-        c.paper_number paperNumber,
-        d.id examTaskId,
-        d.specialty,
-        d.user_id userId,
-        f.real_name userName,
-        ifnull(e.is_try, false) isTry,
-        ifnull(e.is_pass, false) isPass,
-        e.try_time tryTime
+            distinct a.school_id schoolId,
+            a.id printPlanId,
+            a.name printPlanName,
+            c.course_code courseCode,
+            c.course_name courseName,
+            c.paper_number paperNumber,
+            d.id examTaskId,
+            d.specialty,
+            d.user_id userId,
+            f.real_name userName,
+            ifnull(e.is_try, false) isTry,
+            ifnull(e.is_pass, false) isPass,
+            e.try_time tryTime
         FROM
-        exam_print_plan a
+            exam_print_plan a
         JOIN
-        exam_detail b ON a.id = b.print_plan_id
+            exam_detail b ON a.id = b.print_plan_id
         JOIN
-        exam_detail_course c ON b.id = c.exam_detail_id
+            exam_detail_course c ON b.id = c.exam_detail_id
         JOIN
-        exam_task d ON d.school_id = c.school_id
-        AND d.course_code = c.course_code
-        AND d.paper_number = c.paper_number
+            exam_task d ON d.school_id = c.school_id
+            AND d.course_code = c.course_code
+            AND d.paper_number = c.paper_number
+        left join
+            t_f_flow_approve ffa on d.flow_id = ffa.flow_id
         LEFT JOIN
         client_status e ON e.school_id = d.school_id
-        AND b.id = e.exam_detail_id
-        AND a.id = e.print_plan_id
-        AND e.course_code = d.course_code
-        AND e.paper_number = d.paper_number
-        and e.machine_code = #{machineCode}
+            AND b.id = e.exam_detail_id
+            AND a.id = e.print_plan_id
+            AND e.course_code = d.course_code
+            AND e.paper_number = d.paper_number
+            and e.machine_code = #{machineCode}
         LEFT JOIN
-        sys_user f ON d.user_id = f.id
+            sys_user f ON d.user_id = f.id
         LEFT JOIN
-        sys_user g ON a.create_id = g.id
+            sys_user g ON a.create_id = g.id
         <where>
             and a.status = #{printPlanStatus}
-            and d.status = 'FINISH'
+            AND (d.status = 'SUBMIT' and (ffa.status = 'FINISH' or ffa.status is null))
             and LOCATE('PAPER', a.print_content) > 0
             and b.status not in
             <foreach item="item" collection="examDetailStatus" separator="," open="(" close=")" index="">

+ 3 - 7
distributed-print/src/main/java/com/qmth/distributed/print/api/ClientController.java

@@ -81,13 +81,9 @@ public class ClientController {
         if (Objects.isNull(sysUser)) {
             throw ExceptionResultEnum.USER_NO_DATA.exception();
         }
-        AuthBean authBean = teachcloudCommonService.getUserAuth(sysUser.getId());
-        if (Objects.nonNull(authBean) && Objects.nonNull(authBean.getRoleList()) && authBean.getRoleList().size() > 0) {
-            Set<String> roleNames = authBean.getRoleList().stream().map(s -> s.getName()).collect(Collectors.toSet());
-//            if (!roleNames.contains(RoleTypeEnum.PRINTER)) {
-//                throw ExceptionResultEnum.ERROR.exception("客户端只允许" + RoleTypeEnum.PRINTER.getDesc() + "登录");
-//            }
-        }
+        // 是否有客户端权限
+        clientService.checkPrivilege(sysUser.getId());
+
         return ResultUtil.ok(teachcloudCommonService.login(login.getPassword(), sysUser, AppSourceEnum.SYSTEM));
     }
 

+ 3 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPrintPlanSyncController.java

@@ -86,15 +86,15 @@ public class ExamPrintPlanSyncController {
     /**
      * 批量同步
      *
-     * @param printPlanIds
+     * @param syncDataParam
      * @return
      * @throws Exception
      */
     @ApiOperation(value = "印刷计划合并管理-批量同步")
     @RequestMapping(value = "/sync_data_cloud_batch", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = EditResult.class)})
-    public Result syncDataCloudBatch(@RequestParam(value = "printPlanIds") String printPlanIds) {
-        examPrintPlanService.syncDataCloudBatch(printPlanIds);
+    public Result syncDataCloudBatch(@RequestBody SyncDataParam syncDataParam) {
+        examPrintPlanService.syncDataCloudBatch(syncDataParam);
         return ResultUtil.ok(true);
     }
 

+ 1 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java

@@ -274,7 +274,6 @@ public class ExamTaskController {
     @ApiOperation(value = "入库申请查询")
     @RequestMapping(value = "/apply_list", method = RequestMethod.POST)
     public Result taskApplyList(@RequestParam(value = "auditStatus", required = false) String auditStatus,
-                                @RequestParam(value = "reviewStatus", required = false) String reviewStatus,
                                 @RequestParam(value = "cardRuleId", required = false) String cardRuleId,
                                 @RequestParam(value = "courseCode", required = false) String courseCode,
                                 @RequestParam(value = "paperNumber", required = false) String paperNumber,
@@ -283,7 +282,7 @@ public class ExamTaskController {
                                 @RequestParam(value = "userName", required = false) String userName,
                                 @RequestParam("pageNumber") Integer pageNumber,
                                 @RequestParam("pageSize") Integer pageSize) {
-        return ResultUtil.ok(examTaskService.listTaskApply(auditStatus, reviewStatus, SystemConstant.convertIdToLong(cardRuleId), courseCode, paperNumber, startTime, endTime, userName, pageNumber, pageSize));
+        return ResultUtil.ok(examTaskService.listTaskApply(auditStatus, SystemConstant.convertIdToLong(cardRuleId), courseCode, paperNumber, startTime, endTime, userName, pageNumber, pageSize));
     }
 
     /**

+ 3 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/SysPrivilegeMapper.java

@@ -3,6 +3,8 @@ package com.qmth.teachcloud.common.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.teachcloud.common.entity.SysPrivilege;
 
+import java.util.List;
+
 /**
  * <p>
  * 菜单权限表 Mapper 接口
@@ -13,4 +15,5 @@ import com.qmth.teachcloud.common.entity.SysPrivilege;
  */
 public interface SysPrivilegeMapper extends BaseMapper<SysPrivilege> {
 
+    List<SysPrivilege> getClientUrlByUserId(Long userId);
 }

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysPrivilegeService.java

@@ -42,4 +42,6 @@ public interface SysPrivilegeService extends IService<SysPrivilege> {
      * @return
      */
     boolean existsPrivilege(String... urls);
+
+    List<SysPrivilege> getClientUrlByUserId(Long userId);
 }

+ 5 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysPrivilegeServiceImpl.java

@@ -255,4 +255,9 @@ public class SysPrivilegeServiceImpl extends ServiceImpl<SysPrivilegeMapper, Sys
                 .eq(SysPrivilege::getSchoolId, sysUser.getSchoolId());
         return this.count(sysPrivilegeQueryWrapper) > 0 ? true : false;
     }
+
+    @Override
+    public List<SysPrivilege> getClientUrlByUserId(Long userId) {
+        return this.baseMapper.getClientUrlByUserId(userId);
+    }
 }

+ 16 - 2
teachcloud-common/src/main/resources/mapper/SysPrivilegeMapper.xml

@@ -10,14 +10,28 @@
         <result column="type" property="type" />
         <result column="parent_id" property="parentId" />
         <result column="sequence" property="sequence" />
-        <result column="remark" property="remark" />
+        <result column="property" property="property" />
+        <result column="related" property="related" />
+        <result column="enable" property="enable" />
         <result column="create_time" property="createTime" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,
-        school_id, name, url, type, parent_id, sequence, remark, create_id, create_time, update_id, update_time
+        school_id, name, url, type, parent_id, sequence, property, related, create_id, create_time, update_id, update_time
     </sql>
+    <select id="getClientUrlByUserId" resultMap="BaseResultMap">
+        SELECT
+            *
+        FROM
+            sys_privilege sp
+                JOIN
+            sys_role_privilege srp ON sp.id = srp.privilege_id
+                JOIN
+            sys_user_role sur ON srp.role_id = sur.role_id
+        WHERE
+            sur.user_id = #{userId}
+    </select>
 
 </mapper>