he2802 1 год назад
Родитель
Сommit
cd8a43d7b2

+ 10 - 4
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -50,10 +50,7 @@ import com.zhongzheng.modules.distribution.vo.DistributionSellerVo;
 import com.zhongzheng.modules.exam.bo.*;
 import com.zhongzheng.modules.exam.service.IExamApplyService;
 import com.zhongzheng.modules.exam.vo.ExamApplyDetailVo;
-import com.zhongzheng.modules.goods.bo.AlikeGoodsBo;
-import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
-import com.zhongzheng.modules.goods.bo.GoodsStudyUrlBo;
-import com.zhongzheng.modules.goods.bo.UserGoodsListBo;
+import com.zhongzheng.modules.goods.bo.*;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.*;
 import com.zhongzheng.modules.grade.bo.*;
@@ -909,4 +906,13 @@ public class CommonController extends BaseController {
         return AjaxResult.success();
     }
 
+    /**
+     * 回复试卷业务层次
+     */
+    @ApiOperation("回复试卷业务层次")
+    @GetMapping("/common/free/update/exam/business")
+    public AjaxResult<Void> updateExamBusiness() {
+        return toAjax(iGoodsService.updateExamBusiness() ? 1 : 0);
+    }
+
 }

+ 14 - 14
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysLoginService.java

@@ -93,20 +93,20 @@ public class SysLoginService
      */
     public String login(String username, String password, String code, String uuid,String smsCode,String tel)
     {
-//        String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
-//        String captcha = redisCache.getCacheObject(verifyKey);
-//        redisCache.deleteObject(verifyKey);
-//        if (captcha == null)
-//        {
-//            AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
-//            throw new CaptchaExpireException();
-//        }
-//        if (!code.equalsIgnoreCase(captcha))
-//        {
-//            AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
-//            throw new CaptchaException();
-//        }
-//        iUserLoginErrorService.checkLimit(username);
+        String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
+        String captcha = redisCache.getCacheObject(verifyKey);
+        redisCache.deleteObject(verifyKey);
+        if (captcha == null)
+        {
+            AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
+            throw new CaptchaExpireException();
+        }
+        if (!code.equalsIgnoreCase(captcha))
+        {
+            AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
+            throw new CaptchaException();
+        }
+        iUserLoginErrorService.checkLimit(username);
         // 用户验证
         Authentication authentication = null;
         try

+ 23 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java

@@ -2,6 +2,10 @@ package com.zhongzheng.modules.goods.mapper;
 
 import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.bank.domain.Exam;
+import com.zhongzheng.modules.bank.domain.QuestionBusiness;
+import com.zhongzheng.modules.bank.domain.QuestionChapter;
+import com.zhongzheng.modules.bank.domain.QuestionModule;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.bo.ExternalQuestionBo;
 import com.zhongzheng.modules.course.bo.ReplenishExamBo;
@@ -110,4 +114,23 @@ public interface GoodsMapper extends BaseMapper<Goods> {
 
     @InterceptorIgnore(tenantLine = "true")
     Integer getCourseExamNumNoTenant(Long goodsId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<QuestionModule> getModuleExam();
+
+    @InterceptorIgnore(tenantLine = "true")
+    SysGoodsCopyRecord getSysGoodsCopy(@Param("moduleExamId") Long moduleExamId,@Param("type")Integer type);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<QuestionBusiness> getModuleExamBusiness(@Param("oldId")Long oldId,@Param("type")Integer type);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Integer saveExamBusiness(QuestionBusiness bs);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<QuestionChapter> getChapterExam();
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<Exam> getExam();
+
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -167,4 +167,7 @@ public interface IGoodsService extends IService<Goods> {
     Integer getCourseNum(Long goodsId);
 
     Integer getCourseExamNum(Long goodsId);
+
+    Boolean updateExamBusiness();
+
 }

+ 87 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -5298,6 +5298,93 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return baseMapper.getCourseExamNumNoTenant(goodsId);
     }
 
+    @Override
+    public Boolean updateExamBusiness() {
+        //模块卷
+        List<QuestionModule> modules = baseMapper.getModuleExam();
+        if (CollectionUtils.isNotEmpty(modules)){
+            modules.forEach(item -> {
+                Long tenantId = item.getTenantId();
+                SysGoodsCopyRecord copyRecord = baseMapper.getSysGoodsCopy(item.getModuleExamId(),46);
+                if (ObjectUtils.isNull(copyRecord)){
+                    return;
+                }
+                List<QuestionBusiness> businesses = baseMapper.getModuleExamBusiness(copyRecord.getOldId(),4);
+                if (CollectionUtils.isEmpty(businesses)){
+                    return;
+                }
+                //同步模块卷业务层次
+                businesses.forEach(bs -> {
+                    bs.setId(null);
+                    bs.setMajorId(item.getModuleExamId());
+                    bs.setEducationTypeId(getNewIdByTenant(bs.getEducationTypeId(),14,tenantId));
+                    bs.setProjectId(getNewIdByTenant(bs.getProjectId(),22,tenantId));
+                    bs.setBusinessId(getNewIdByTenant(bs.getBusinessId(),9,tenantId));
+                    bs.setSubjectId(getNewIdByTenant(bs.getSubjectId(),26,tenantId));
+                    bs.setTenantId(tenantId);
+                    baseMapper.saveExamBusiness(bs);
+                });
+            });
+        }
+
+        //章卷
+        List<QuestionChapter> chapters = baseMapper.getChapterExam();
+        if (CollectionUtils.isNotEmpty(chapters)){
+            chapters.forEach(item -> {
+                Long tenantId = item.getTenantId();
+                SysGoodsCopyRecord copyRecord = baseMapper.getSysGoodsCopy(item.getChapterExamId(),44);
+                if (ObjectUtils.isNull(copyRecord)){
+                    return;
+                }
+                List<QuestionBusiness> businesses = baseMapper.getModuleExamBusiness(copyRecord.getOldId(),3);
+                if (CollectionUtils.isEmpty(businesses)){
+                    return;
+                }
+
+                //同步模块卷业务层次
+                businesses.forEach(bs -> {
+                    bs.setId(null);
+                    bs.setMajorId(item.getChapterExamId());
+                    bs.setEducationTypeId(getNewIdByTenant(bs.getEducationTypeId(),14,tenantId));
+                    bs.setProjectId(getNewIdByTenant(bs.getProjectId(),22,tenantId));
+                    bs.setBusinessId(getNewIdByTenant(bs.getBusinessId(),9,tenantId));
+                    bs.setSubjectId(getNewIdByTenant(bs.getSubjectId(),26,tenantId));
+                    bs.setTenantId(tenantId);
+
+                    baseMapper.saveExamBusiness(bs);
+                });
+            });
+        }
+
+        //试卷
+        List<Exam> exam = baseMapper.getExam();
+        if (CollectionUtils.isNotEmpty(exam)){
+            exam.forEach(item -> {
+                Long tenantId = item.getTenantId();
+                SysGoodsCopyRecord copyRecord = baseMapper.getSysGoodsCopy(item.getExamId(),28);
+                if (ObjectUtils.isNull(copyRecord)){
+                    return;
+                }
+                List<QuestionBusiness> businesses = baseMapper.getModuleExamBusiness(copyRecord.getOldId(),2);
+                if (CollectionUtils.isEmpty(businesses)){
+                    return;
+                }
+                //同步模块卷业务层次
+                businesses.forEach(bs -> {
+                    bs.setId(null);
+                    bs.setMajorId(item.getExamId());
+                    bs.setEducationTypeId(getNewIdByTenant(bs.getEducationTypeId(),14,tenantId));
+                    bs.setProjectId(getNewIdByTenant(bs.getProjectId(),22,tenantId));
+                    bs.setBusinessId(getNewIdByTenant(bs.getBusinessId(),9,tenantId));
+                    bs.setSubjectId(getNewIdByTenant(bs.getSubjectId(),26,tenantId));
+                    bs.setTenantId(tenantId);
+
+                    baseMapper.saveExamBusiness(bs);
+                });
+            });
+        }
+        return true;
+    }
 
     private void updateHandoutsId(Long goodsId, Long tenantId, Long handoutsId) {
         baseMapper.updateHandoutsId(goodsId, tenantId, handoutsId);

+ 7 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -663,13 +663,13 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
     public boolean syncStudyLogToOld(UserPeriodEditBo bo) {
         //企业ID
         String tenant = ServletUtils.getRequest().getHeader("TenantId");
-        SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
-                .eq(SysOldOrg::getTenantId, tenant)
-                .last("limit 1")).stream().findFirst().orElse(null);
-        if (org.getShareClass() == 0){
-            //有职能的机构学时不推送旧系统
-            return true;
-        }
+//        SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
+//                .eq(SysOldOrg::getTenantId, tenant)
+//                .last("limit 1")).stream().findFirst().orElse(null);
+//        if (org.getShareClass() == 0){
+//            //有职能的机构学时不推送旧系统
+//            return true;
+//        }
         CourseEducationType educationType = iCourseEducationTypeService.getOne(new LambdaQueryWrapper<CourseEducationType>().eq(CourseEducationType::getStatus, 1).eq(CourseEducationType::getEducationName,"继续教育").last("limit 1"));
         CourseProjectType projectType = iCourseProjectTypeService.getOne(new LambdaQueryWrapper<CourseProjectType>().eq(CourseProjectType::getStatus, 1).eq(CourseProjectType::getEducationId,educationType.getId()).eq(CourseProjectType::getProjectName,"建造师").last("limit 1"));
         CourseBusiness business = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getStatus, 1).eq(CourseBusiness::getProjectId,projectType.getId()).eq(CourseBusiness::getBusinessName,"二级").last("limit 1"));

+ 25 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -970,6 +970,31 @@
         WHERE goods_name = #{goodsName} and code = #{code} and tenant_id = #{tenantId}
     </select>
 
+    <select id="getModuleExam" resultType="com.zhongzheng.modules.bank.domain.QuestionModule">
+        SELECT * FROM question_module qm WHERE (SELECT COUNT( qb.id)FROM question_business qb WHERE qb.major_id = qm.module_exam_id AND qb.type = 4) &lt;= 0 AND `status` = 1
+    </select>
+
+    <select id="getChapterExam" resultType="com.zhongzheng.modules.bank.domain.QuestionChapter">
+        SELECT * FROM question_chapter qm WHERE (SELECT COUNT( qb.id)FROM question_business qb WHERE qb.major_id = qm.chapter_exam_id AND qb.type = 3) &lt;= 0 AND `status` = 1
+    </select>
+
+    <select id="getExam" resultType="com.zhongzheng.modules.bank.domain.Exam">
+        SELECT * FROM exam qm WHERE (SELECT COUNT( qb.id)FROM question_business qb WHERE qb.major_id = qm.exam_id AND qb.type = 2) &lt;= 0 AND `status` = 1
+    </select>
+
+    <select id="getSysGoodsCopy" parameterType="map" resultType="com.zhongzheng.modules.system.domain.SysGoodsCopyRecord">
+        SELECT * FROM sys_goods_copy_record WHERE new_id = #{moduleExamId} AND type = #{type} LIMIT 1
+    </select>
+
+    <select id="getModuleExamBusiness" parameterType="map" resultType="com.zhongzheng.modules.bank.domain.QuestionBusiness">
+        SELECT * FROM question_business WHERE major_id = #{oldId} AND type = #{type} AND tenant_id = 867735392558919680
+    </select>
+
+    <insert id="saveExamBusiness" parameterType="com.zhongzheng.modules.bank.domain.QuestionBusiness" >
+        INSERT INTO question_business (education_type_id,business_id,tenant_id,project_id,subject_id,major_id,type)
+        VALUES(#{educationTypeId},#{businessId},#{tenantId},#{projectId},#{subjectId},#{majorId},#{type})
+    </insert>
+
     <update id="updateByTenant" parameterType="com.zhongzheng.modules.goods.domain.Goods">
         UPDATE goods
         SET `year`                  = #{year},