hfxc226 3 years ago
parent
commit
ee22bd65e7

+ 13 - 100
platform-dao/src/main/resources/mapper/sb/SbInfoMeasureMapper.xml

@@ -195,33 +195,17 @@ sb.scrap_user_name
             sb.card_no like concat('%',#{keyword},'%')
             )
         </if>
-        <if test="cardNo != null and cardNo!=''">
-            and sb.card_no like concat('%',#{cardNo},'%')
-        </if>
-        <if test="no != null and no!=''">
-            and sb.no like concat('%',#{no},'%')
-        </if>
-        <if test="zbh != null and zbh!=''">
-            and sb.zbh like concat('%',#{zbh},'%')
-        </if>
-        <if test="financingNo != null and financingNo!=''">
-            and sb.financing_no like concat(#{financingNo},'%')
+        <if test="isFinancing != null">
+            and sb.is_financing like concat('%',#{isFinancing},'%')
         </if>
         <if test="zzh != null">
-            and sb.zzh = #{zzh}
-        </if>
-        <if test="isShow != null">
-            and sb.is_show = #{isShow}
+            and sb.zzh like concat('%',#{zzh},'%')
         </if>
-        <if test="isFinancing != null">
-            and sb.is_financing = #{isFinancing}
-        </if>
-
         <if test="model != null">
             and sb.model like concat('%',#{model},'%')
         </if>
         <if test="useDept != null">
-            and sb.use_dept = #{useDept}
+            and sb.use_dept like concat('%',#{useDept},'%')
         </if>
         <if test="nextCheckDateStart != null">
             and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
@@ -229,24 +213,14 @@ sb.scrap_user_name
         <if test="nextCheckDateEnd != null">
             and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
         </if>
-        <if test="repairUser != null">
-            and sb.repair_user = #{repairUser}
-        </if>
-        <if test="repairUserSecond != null">
-            and sb.repair_user_second = #{repairUserSecond}
-        </if>
-        <if test="repairUserSearch != null">
-            and (
-            sb.repair_user = #{repairUserSearch}
-            or
-            sb.repair_user_second = #{repairUserSearch}
-            )
-        </if>
         <if test="status != null">
             and sb.status = #{status}
         </if>
-        <if test="modelId != null">
-            and sb.model_id = #{modelId}
+        <if test="cardNo != null">
+            and sb.card_no like concat('%',#{cardNo},'%')
+        </if>
+        <if test="seatNumber != null">
+            and TIMESTAMPDIFF( DAY, CURDATE( ), sb.next_check_date ) <![CDATA[ <= ]]> sb.seat_number
         </if>
         <if test="notStatusList != null and notStatusList.size > 0">
             AND sb.status not in
@@ -266,9 +240,6 @@ sb.scrap_user_name
                 #{item}
             </foreach>
         </if>
-        <if test="ascriptionDept != null and ascriptionDept">
-            <include refid="deptSql"/>
-        </if>
     </select>
 
     <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoMeasureDTO"
@@ -297,13 +268,13 @@ sb.scrap_user_name
             and sb.use_project = #{useProject}
         </if>
         <if test="zzh != null">
-            and sb.zzh = #{zzh}
+            and sb.zzh like concat('%',#{zzh},'%')
         </if>
         <if test="model != null">
             and sb.model like concat('%',#{model},'%')
         </if>
         <if test="useDept != null">
-            and sb.use_dept = #{useDept}
+            and sb.use_dept like concat('%',#{useDept},'%')
         </if>
         <if test="nextCheckDateStart != null">
             and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
@@ -314,8 +285,8 @@ sb.scrap_user_name
         <if test="status != null">
             and sb.status = #{status}
         </if>
-        <if test="modelId != null">
-            and sb.model_id = #{modelId}
+        <if test="cardNo != null">
+            and sb.card_no like concat('%',#{cardNo},'%')
         </if>
         <if test="notStatusList != null and notStatusList.size > 0">
             AND sb.status not in
@@ -354,62 +325,4 @@ sb.scrap_user_name
         </foreach>
     </select>
 
-    <select id="selectNameById" parameterType="Object" resultType="java.lang.String">
-        select name
-        from t_sb_info_measure
-        where id = #{value}
-    </select>
-
-    <select id="selectNoById" parameterType="Object" resultType="java.lang.String">
-        select no
-        from t_sb_info_measure
-        where id = #{value}
-    </select>
-
-    <update id="updateBatch" parameterType="java.util.List">
-        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
-            update t_sb_info_measure
-            <set>
-                last_baoyang_time=#{item.lastBaoyangTimes},
-                last_baoyang_hours=#{item.lastBaoyangHours},
-                last_baoyang_miles=#{item.lastBaoyangMiles}
-            </set>
-            where id = #{item.id}
-        </foreach>
-    </update>
-
-    <update id="updateBatchQrCode" parameterType="java.util.List">
-        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
-            update t_sb_info_measure
-            <set>
-                qr_code=#{item.qrCode}
-            </set>
-            where id = #{item.id}
-        </foreach>
-    </update>
-
-    <update id="updateBatchChild" parameterType="java.util.List">
-        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
-            update t_sb_info_measure
-            <set>
-                parent_id = #{item.parentId}
-            </set>
-            where id = #{item.id}
-        </foreach>
-    </update>
-
-    <update id="updateBatchValue" parameterType="java.util.List">
-        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
-            update t_sb_info_measure
-            <set>
-                initial_value=#{item.initialValue},
-                current_value=#{item.currentValue},
-                cut_value=#{item.cutValue},
-                month=#{item.month},
-                rate=#{item.rate},
-                used_month=#{item.usedMonth}
-            </set>
-            where id = #{item.id}
-        </foreach>
-    </update>
 </mapper>

+ 14 - 11
platform-service/src/main/java/com/platform/service/sb/impl/SbMeasureLogServiceImpl.java

@@ -96,22 +96,24 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
     @Override
     public SbMeasureLog saveModelByDTO(SbMeasureLogDTO model) {
         SbMeasureLog sbMeasureLog = super.saveModelByDTO(model);
-
+        model.setId(sbMeasureLog.getId());
         // 更新设备下次检定日期
         SbInfoMeasure sbInfo = sbInfoMeasureMapper.selectByPrimaryKey(model.getSbId());
         sbInfo.setCheckDate(model.getLastDate());
         Integer checkPeriod = 12;// 默认12个月
         if(sbInfo.getCheckPeriod() != null){
             checkPeriod = sbInfo.getCheckPeriod();
-        }
-        if(model.getCheckPeriod() != null){
-            checkPeriod = model.getCheckPeriod();
-            sbInfo.setCheckPeriod(model.getCheckPeriod());
+        }else{
+            throw new BusinessException("检定设备的检定周期为设置,无法计算下次检定日期,请先设置");
         }
         if(model.getCardNo() != null){
             sbInfo.setCardNo(model.getCardNo());
         }
         sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod));
+        sbInfo.setZaiz(model.getName());// 检定单位
+        sbInfo.setSbdh(model.getNo());// 检定编号
+        sbInfo.setDph(model.getRequirement());// 检定人
+        // 检定单位
         sbInfoMeasureMapper.updateByPrimaryKey(sbInfo);
 
         // 保存文件
@@ -136,15 +138,16 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         Integer checkPeriod = 12;// 默认12个月
         if(sbInfo.getCheckPeriod() != null){
             checkPeriod = sbInfo.getCheckPeriod();
-        }
-        if(model.getCheckPeriod() != null){
-            checkPeriod = model.getCheckPeriod();
-            sbInfo.setCheckPeriod(model.getCheckPeriod());
+        }else{
+            throw new BusinessException("检定设备的检定周期为设置,无法计算下次检定日期,请先设置");
         }
         if(model.getCardNo() != null){
             sbInfo.setCardNo(model.getCardNo());
         }
-        sbInfo.setNextCheckDate(model.getLastDate().minusDays(sbInfo.getCheckPeriod()));
+        sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod));
+        sbInfo.setZaiz(model.getName());// 检定单位
+        sbInfo.setSbdh(model.getNo());// 检定编号
+        sbInfo.setDph(model.getRequirement());// 检定人
         sbInfoMeasureMapper.updateByPrimaryKey(sbInfo);
 
         // 保存文件
@@ -194,7 +197,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         checkStandard.setParamList(paramList);*/
 
         SbInfoMeasure sbInfo = sbInfoMeasureMapper.selectByPrimaryKey(checkStandard.getSbId());
-        checkStandard.setSbNo(sbInfo.getNo());
+        checkStandard.setSbNo(sbInfo.getCardNo());
         checkStandard.setSbModel(sbInfo.getModel());
         checkStandard.setSbName(sbInfo.getName());
         checkStandard.setCheckPeriod(sbInfo.getCheckPeriod());