Prechádzať zdrojové kódy

考试关联培训兼容新版

wy 6 mesiacov pred
rodič
commit
ba042ccb58

+ 14 - 3
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/sqlzdy/Service/SwdlServiceImpl.java

@@ -19,6 +19,7 @@ import com.lc.ibps.org.api.IPartyPositionService;
 import com.lc.ibps.org.party.persistence.entity.PartyPositionPo;
 import com.lc.ibps.sysdata.dao.UpdateDataTableDao;
 import com.lc.ibps.untils.JsonUtil;
+import com.lc.ibps.untils.settingUtil;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -122,9 +123,19 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
                 map.put("locationId", getDiDian());
             }
             Map mapDeal = getMap(map);
-            List<Map<String, Object>> list = updateDataTableDao.selectExInfoByLocation(mapDeal);
-            int totalCount = updateDataTableDao.selectExInfoByLocationCount(mapDeal);
-            int totalCountNull = updateDataTableDao.selectExInfoByLocationCountNull(mapDeal);
+            List<Map<String, Object>> list = new ArrayList<>();
+            String px = settingUtil.getPx();
+            int totalCount = 0;
+            int totalCountNull = 0;
+            if(BeanUtils.isNotEmpty(px) && "1".equals(px)){
+                list = updateDataTableDao.selectExInfoByNLocation(mapDeal);
+                totalCount = updateDataTableDao.selectExInfoByNLocationCount(mapDeal);
+                totalCountNull = updateDataTableDao.selectExInfoByNLocationCountNull(mapDeal);
+            }else{
+                list = updateDataTableDao.selectExInfoByLocation(mapDeal);
+                totalCount = updateDataTableDao.selectExInfoByLocationCount(mapDeal);
+                totalCountNull = updateDataTableDao.selectExInfoByLocationCountNull(mapDeal);
+            }
             APIPageList<Map<String, Object>> pageList = getAPIPageList(list);
             APIPageResult pageResult = new APIPageResult();
             pageResult.setTotalCount(totalCount+totalCountNull);

+ 6 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/sysdata/dao/UpdateDataTableDao.java

@@ -83,8 +83,14 @@ public interface UpdateDataTableDao {
 
     List<Map<String, Object>> selectExInfoByLocation(@Param("map") Map<String, Object> map);
 
+    List<Map<String, Object>>  selectExInfoByNLocation(@Param("map") Map<String, Object> map);
+
     int selectExInfoByLocationCount(@Param("map") Map<String,Object> map);
 
+    int selectExInfoByNLocationCount(@Param("map") Map<String,Object> map);
+
+    int selectExInfoByNLocationCountNull(@Param("map") Map mapDeal);
+
     List<Map<String, Object>> selectMobileInspection(@Param("map") Map<String, Object> map);
 
     int selectMobileInspectionCount(@Param("map") Map<String, Object> map);

+ 72 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/untils/settingUtil.java

@@ -0,0 +1,72 @@
+package com.lc.ibps.untils;
+
+import com.lc.ibps.base.core.util.AppUtil;
+import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.base.framework.table.ICommonDao;
+import com.lc.ibps.base.web.context.ContextUtil;
+import com.lc.ibps.bpmn.service.impl.BpmProcInstServiceImpl;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 转换setting的工具类,业务模块直接取这边的方法即可拿到最终值
+ * 依据setting配置的层级自行判断转换逻辑
+ */
+public class settingUtil {
+    private static final Logger logger = LoggerFactory.getLogger(BpmProcInstServiceImpl.class);
+    private static ICommonDao<?> commonDao = AppUtil.getBean(ICommonDao.class);
+
+    //获取setting
+    public static HashMap<String, Object> getSetting(){
+        HashMap<String, Object> map = new HashMap<>();
+        try {
+            String setting = ContextUtil.getSetting();
+             map =(HashMap) jsonStringToMap(setting);
+        }catch (Exception e){
+            logger.warn("setting获取异常");
+        }
+        return map;
+    }
+    //获取培训方法
+    public static String getPx(){
+        String version = "";
+        try {
+            HashMap<String, Object> setting = getSetting();
+            HashMap<String, Object> option = (HashMap)setting.get("pxSpectacularsOption");
+            version = option.get("version").toString();
+        }catch (Exception e){
+            logger.warn("version转换异常或没有配置");
+        }
+        return version;
+    }
+    //获取XXX
+    //...
+
+    //转换map方法
+    public static Map<String, Object> jsonStringToMap(String jsonString) {
+        try {
+            ObjectMapper objectMapper = new ObjectMapper();
+            return objectMapper.readValue(jsonString, Map.class);
+        } catch (Exception e) {
+            throw new RuntimeException("JSON转换失败", e);
+        }
+    }
+
+    //1、获取当前用户的主部门,默认取第一个主部门,不排除用户有多个主部门的情况,
+   //   虽然用户有多个主部门时无法登入,需要预防有沙雕瞎鸡儿操作,此处不仅指客户,还有不法分子,emmmm____
+    //获取主部门,取第一个
+    public static String getMianPosition(){
+        String psoition = "";
+        List<Map<String, Object>> query =
+                (List<Map<String, Object>>) commonDao.query("SELECT MAIN_PID_ FROM ibps_party_rel WHERE MAIN_TYPE_ = 'position' AND SUB_PID_ = #{p0} AND BIZ_ = 'mainPost'", new String[]{ContextUtil.getCurrentUserId()});
+       if(BeanUtils.isNotEmpty(query) && BeanUtils.isNotEmpty(query.get(0).get("MAIN_PID_").toString())){
+           psoition = query.get(0).get("MAIN_PID_").toString();
+       }
+        return psoition;
+    }
+}

+ 130 - 0
ibps-provider-root/modules/provider-business/src/main/resources/com/lc/ibps/klimsibps/mapping/UpdateDataTableMapper.xml

@@ -350,6 +350,76 @@
             </if>
         </where>
     </select>
+
+    <select id="selectExInfoByNLocation" resultType="java.util.Map" parameterType="java.util.Map">
+        select
+        qb.ti_ku_ming_cheng_ as bankName,
+        f.pei_xun_nei_rong_ as trainId,
+        ex.id_ as examId,
+        ex.ti_ku_id_ as bankId,
+        e.id_ as paperId,
+        ex.zhuang_tai_ as examState,
+        e.zhuang_tai_ as paperState,
+        qb.ti_shu_ as questionCount,
+        qb.zong_fen_ as totalScore,
+        ex.kao_shi_ming_chen as examName,
+        ex.kao_shi_lei_xing_ as examType,
+        ex.can_kao_ren_yuan_ as examinee,
+        e.kao_shi_ren_ as examineeId,
+        ex.create_by_ as createBy,
+        ex.chuang_jian_shi_j as createTime,
+        ex.fa_bu_shi_jian_ as publishDate,
+        ex.fa_bu_ren_ as publisher,
+        ex.xian_kao_shi_jian as limitDate,
+        ex.kao_shi_shi_chang as duration,
+        ex.xian_kao_ci_shu_ as limitCount,
+        ex.da_biao_zhan_bi_ as qualifiedRadio,
+        ex.ji_fen_fang_shi_ as scoringType,
+        ex.yun_xu_bao_ming_ as allowRegist,
+        ex.kao_shi_miao_shu_ as examDesc,
+        ex.shu_ju_yong_tu_ as dataType,
+        ex.sui_ji_chou_ti_ as isRand,
+        ex.chou_ti_fang_shi_ as randWay,
+        ex.sui_ji_ti_shu_ as randNumber,
+        ex.chou_ti_zong_fen_ as randScore,
+        ex.ti_mu_zong_shu_ as randTotal,
+        e.de_fen_ as score,
+        e.bao_ming_shi_jian as applyTime,
+        e.kai_shi_shi_jian_ as startTime,
+        e.jie_shu_shi_jian_ as endTime
+
+        from t_exams ex left join t_question_bank qb on ex.ti_ku_id_ = qb.id_
+        left join t_examination e on e.exam_id_ = ex.id_
+        left join t_lhrypxjlb f on f.id_=ex.guan_lian_id_
+        <where>
+            ex.di_dian_ = #{map.locationId}
+            <if test="@o.Ognl@isNotEmpty(map.kaoShiMingChen)">
+                and ex.kao_shi_ming_chen like CONCAT('%', #{map.kaoShiMingChen}, '%')
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.kaoShiLeiXing)">
+                AND FIND_IN_SET(ex.kao_shi_lei_xing_,#{map.kaoShiLeiXing})
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.zhuangTai)">
+                AND FIND_IN_SET(ex.zhuang_tai_,#{map.zhuangTai})
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.tiKuId)">
+                AND FIND_IN_SET(ex.ti_ku_id_,#{map.tiKuId})
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.chuangJianShiJUp)">
+                AND (ex.chuang_jian_shi_j >= #{map.chuangJianShiJUp} OR ex.chuang_jian_shi_j is null)
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.chuangJianShiJLower)">
+                AND (ex.chuang_jian_shi_j <![CDATA[ <= ]]> #{map.chuangJianShiJLower} OR ex.chuang_jian_shi_j is null)
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.faBuShiJianUp)">
+                AND (ex.fa_bu_shi_jian_ >= #{map.faBuShiJianUp} OR ex.chuang_jian_shi_j is null)
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.faBuShiJianLower)">
+                AND (ex.fa_bu_shi_jian_ <![CDATA[ <= ]]> #{map.faBuShiJianLower} OR ex.chuang_jian_shi_j is null)
+            </if>
+        </where>
+    </select>
+
     <select id="selectExInfoByLocationCount" resultType="java.lang.Integer" parameterType="java.util.Map">
         select
         count(*) as count
@@ -485,6 +555,42 @@
         ORDER BY startDate
         limit ${map.startPage},${map.limit}
     </select>
+
+    <select id="selectExInfoByNLocationCount" resultType="java.lang.Integer" parameterType="java.util.Map">
+        select
+        count(*) as count
+        from t_exams ex left join t_question_bank qb on ex.ti_ku_id_ = qb.id_
+        left join t_examination e on e.exam_id_ = ex.id_
+        left join t_lhrypxjlb f on f.id_=ex.guan_lian_id_
+        <where>
+            ex.di_dian_ = #{map.locationId}
+            <if test="@o.Ognl@isNotEmpty(map.kaoShiMingChen)">
+                and ex.kao_shi_ming_chen like CONCAT('%', #{map.kaoShiMingChen}, '%')
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.kaoShiLeiXing)">
+                AND FIND_IN_SET(ex.kao_shi_lei_xing_,#{map.kaoShiLeiXing})
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.zhuangTai)">
+                AND FIND_IN_SET(ex.zhuang_tai_,#{map.zhuangTai})
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.tiKuId)">
+                AND FIND_IN_SET(ex.ti_ku_id_,#{map.tiKuId})
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.chuangJianShiJUp)">
+                AND ex.chuang_jian_shi_j >= #{map.chuangJianShiJUp}
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.chuangJianShiJLower)">
+                AND ex.chuang_jian_shi_j <![CDATA[ <= ]]> #{map.chuangJianShiJLower}
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.faBuShiJianUp)">
+                AND ex.fa_bu_shi_jian_ >= #{map.faBuShiJianUp}
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.faBuShiJianLower)">
+                AND ex.fa_bu_shi_jian_ <![CDATA[ <= ]]> #{map.faBuShiJianLower}
+            </if>
+        </where>
+    </select>
+
     <select id="selectMobileExInfoCount" resultType="java.lang.Integer" parameterType="java.util.Map">
         select
         count(*)
@@ -521,6 +627,30 @@
         </where>
     </select>
 
+    <select id="selectExInfoByNLocationCountNull" resultType="java.lang.Integer" parameterType="java.util.Map">
+        select
+        count(*) as count
+        from t_exams ex left join t_question_bank qb on ex.ti_ku_id_ = qb.id_
+        left join t_examination e on e.exam_id_ = ex.id_
+        left join t_lhrypxjlb f on f.id_=ex.guan_lian_id_
+        <where>
+            ex.di_dian_ = #{map.locationId}
+            <if test="@o.Ognl@isNotEmpty(map.kaoShiMingChen)">
+                and ex.kao_shi_ming_chen like CONCAT('%', #{map.kaoShiMingChen}, '%')
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.kaoShiLeiXing)">
+                AND FIND_IN_SET(ex.kao_shi_lei_xing_,#{map.kaoShiLeiXing})
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.zhuangTai)">
+                AND FIND_IN_SET(ex.zhuang_tai_,#{map.zhuangTai})
+            </if>
+            <if test="@o.Ognl@isNotEmpty(map.tiKuId)">
+                AND FIND_IN_SET(ex.ti_ku_id_,#{map.tiKuId})
+            </if>
+            and ex.chuang_jian_shi_j is null or ex.fa_bu_shi_jian_ is null
+        </where>
+    </select>
+
     <select id="selectAttendanceData" resultType="java.util.Map" parameterType="java.util.Map">
         SELECT
         t.*,