linfutong лет назад: 3
Родитель
Сommit
ee9457c89f

+ 16 - 6
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanAbnormalDescServiceImpl.java

@@ -102,11 +102,21 @@ public class LabRiskPlanAbnormalDescServiceImpl implements ILabRiskPlanAbnormalD
 
 
     @Override
     @Override
     public int updateLabRiskPlanAbnormalDesc(long groupId, String handledPerson, String recordVideo) {
     public int updateLabRiskPlanAbnormalDesc(long groupId, String handledPerson, String recordVideo) {
-        LabRiskPlanAbnormalDesc desc = new LabRiskPlanAbnormalDesc();
-        desc.setGroupId(groupId);
-        desc.setHandledPerson(handledPerson);
-        desc.setRecordVideo(recordVideo);
-        desc.setUpdateTime(new Date());
-        return labRiskPlanAbnormalDescMapper.updateByGroupId(desc);
+        LabRiskPlanAbnormalDesc query = new LabRiskPlanAbnormalDesc();
+        query.setGroupId(groupId);
+        List<LabRiskPlanAbnormalDesc> list = labRiskPlanAbnormalDescMapper.selectByList(query);
+        if (list != null && list.size() > 0) {
+            LabRiskPlanAbnormalDesc desc = list.get(0);
+            long start = desc.getStartDate().getTime();
+            Date now = new Date();
+            desc.setEndDate(now);
+            long rd = ((now.getTime() - start) / 1000);
+            desc.setRiskDuration(rd);
+            desc.setHandledPerson(handledPerson);
+            desc.setRecordVideo(recordVideo);
+            desc.setUpdateTime(new Date());
+            return labRiskPlanAbnormalDescMapper.updateByGroupId(desc);
+        }
+        return 0;
     }
     }
 }
 }

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabRiskPlanAbnormalDescMapper.xml

@@ -109,7 +109,7 @@
     <select id="selectByList" parameterType="com.zd.laboratory.domain.LabRiskPlanAbnormalDesc" resultMap="BaseResult">
     <select id="selectByList" parameterType="com.zd.laboratory.domain.LabRiskPlanAbnormalDesc" resultMap="BaseResult">
         <include refid="selectBaseColumn"/>
         <include refid="selectBaseColumn"/>
         <where>
         <where>
-            <if test="groupId != null and groupId != 0">AND group_id =#{groupId}</if>
+            <if test="groupId != null and groupId != 0">AND group_id = #{groupId}</if>
             <if test="riskReason != null and riskReason != ''">AND risk_reason = #{riskReason}</if>
             <if test="riskReason != null and riskReason != ''">AND risk_reason = #{riskReason}</if>
             <if test="riskLevel != null">AND risk_level = #{riskLevel}</if>
             <if test="riskLevel != null">AND risk_level = #{riskLevel}</if>
             <if test="startDate != null">AND start_date = #{startDate}</if>
             <if test="startDate != null">AND start_date = #{startDate}</if>