Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

zouxuan 4 rokov pred
rodič
commit
3c6b7b547e

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/InspectionItemPlanDao.java

@@ -31,5 +31,6 @@ public interface InspectionItemPlanDao extends BaseDAO<Long, InspectionItemPlan>
      *
      * @return
      */
-    int getMusicGroupItemPlanCount(@Param("itemId") Long itemId, @Param("musicGroupId") String musicGroupId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
+    int getMusicGroupItemPlanCount(@Param("itemId") Long itemId, @Param("musicGroupId") String musicGroupId,
+                                   @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("id") Long id);
 }

+ 11 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/InspectionItemPlanServiceImpl.java

@@ -90,8 +90,9 @@ public class InspectionItemPlanServiceImpl extends BaseServiceImpl<Long, Inspect
         //事项计划同一乐团同一天不能重复
         Date dayStartTime = DateUtil.trunc(inspectionItemPlan.getPlanStart());
         Date dayEndTime = DateUtil.trunc(inspectionItemPlan.getPlanStart());
-        int dayMusicGroupItemPlanCount = inspectionItemPlanDao.getMusicGroupItemPlanCount(inspectionItemPlan.getItemId(), inspectionItemPlan.getMusicGroupId(), dayStartTime, dayEndTime);
-        if(dayMusicGroupItemPlanCount > 0){
+        int dayMusicGroupItemPlanCount = inspectionItemPlanDao.getMusicGroupItemPlanCount(inspectionItemPlan.getItemId(),
+                inspectionItemPlan.getMusicGroupId(), dayStartTime, dayEndTime, null);
+        if (dayMusicGroupItemPlanCount > 0) {
             throw new BizException("该乐团当天已有巡查安排,请核查");
         }
         //获取乐团教学点的GPS信息
@@ -139,6 +140,14 @@ public class InspectionItemPlanServiceImpl extends BaseServiceImpl<Long, Inspect
         if (itemEndTime.before(inspectionItemPlan.getPlanEnd())) {
             throw new BizException("日程时间不能晚于工作周期结束时间");
         }
+        //事项计划同一乐团同一天不能重复
+        Date dayStartTime = DateUtil.trunc(inspectionItemPlan.getPlanStart());
+        Date dayEndTime = DateUtil.trunc(inspectionItemPlan.getPlanStart());
+        int dayMusicGroupItemPlanCount = inspectionItemPlanDao.getMusicGroupItemPlanCount(inspectionItemPlan.getItemId(),
+                inspectionItemPlan.getMusicGroupId(), dayStartTime, dayEndTime, inspectionItemPlan.getId());
+        if (dayMusicGroupItemPlanCount > 0) {
+            throw new BizException("该乐团当天已有巡查安排,请核查");
+        }
         //获取乐团教学点的GPS信息
         if (oldPlan.getStatus().equals(0)) { //未提交的修改
             //获取乐团教学点的GPS信息

+ 1 - 0
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -204,6 +204,7 @@
 		LEFT JOIN sys_user su ON sees.student_id_=su.id_
 		WHERE su.del_flag_=0
 			AND su.organ_id_ IS NOT NULL
+			AND MONTH(sees.monday_)=MONTH(CONCAT(#{month}, '-01'))
 			AND sees.monday_&lt;=#{dayStr}
 		GROUP BY su.organ_id_
 		ORDER BY su.organ_id_

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/InspectionItemPlanMapper.xml

@@ -206,5 +206,8 @@
           AND plan_start_ >= #{startTime}
           AND plan_start_ <= #{endTime}
         ]]>
+        <if test="id != null">
+            AND id_ != #{id}
+        </if>
     </select>
 </mapper>