Jelajahi Sumber

bug:班长重复扣分

温红权 8 tahun lalu
induk
melakukan
7f70ea2048

+ 10 - 2
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -58,7 +58,7 @@
          
     <select id="selectMList"  parameterType="com.xintong.visualinspection.pojo.TaskAndScore" resultType="com.xintong.visualinspection.pojo.TaskAndScore">
    
-	    SELECT * from check_task a LEFT JOIN check_score b on a.id=b.task_id where
+	    SELECT a.*,b.id as id1 ,b.update_time as update_time1,b.content,b.pics,b.videos,b.task_id,b.check_item_id,b.checkman as checkman1,b.checked_person as checked_person1 ,b.checked_dept as checked_dept1,b.remark as remark1,b.check_item_score  from check_task a LEFT JOIN check_score b on a.id=b.task_id where
 	          a.monitor_user_id != -1 and a.monitor_user_id != 0 and 
 	       a.start_time &gt;= #{start_time} and a.end_time &lt; #{end_time} and a.check_status !=22 and a.id not in <include refid="taskexclouddeleteUser"/>
 	    
@@ -487,7 +487,15 @@
            ,cst.update_time,t.id as task_id
          </if>
 
-         FROM v_check_task t
+         FROM
+         <if test="queryType!=null and queryType==0">
+             check_task
+         </if>
+
+         <if test="queryType==null or (queryType!=null and queryType==1) ">
+             v_check_task
+         </if>
+          t
      		LEFT JOIN check_score cs ON t.id = cs.task_id
 
          <if test="queryType!=null and queryType==1">

+ 20 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -170,11 +170,14 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			// 班长扣分加上成员的扣分
 			for (TaskAndScore s : taskAndScores) {
 				if (s.getMonitor_user_id().intValue() == b.getUser().getId().intValue()
-						&& s.getCheck_item_score() != null) {
+						&& s.getCheck_item_score() != null && ((s.getChecked_person1()==null && s.getChecked_person().intValue() != s.getMonitor_user_id().intValue())
+                        ||(s.getChecked_person1()!=null && s.getChecked_person1().intValue() !=s.getMonitor_user_id().intValue()))) {
 					b.setCheck_all_m_score(b.getCheck_all_m_score() + s.getCheck_item_score());
 				}
 
-				if (s.getMonitor_user_id().intValue() == b.getUser().getId().intValue()) {
+				if (s.getMonitor_user_id().intValue() == b.getUser().getId().intValue() &&
+                        ((s.getChecked_person1()==null && s.getChecked_person().intValue() != s.getMonitor_user_id().intValue())
+                                ||(s.getChecked_person1()!=null && s.getChecked_person1().intValue() !=s.getMonitor_user_id().intValue()))) {
 					b.setChecked_m_num(b.getChecked_m_num() + 1);
 				}
 			}
@@ -1787,8 +1790,21 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
         		masterMap.put(score.getMonitor_user_id(), new StatisticsBo());
         	}
         	StatisticsBo sb = masterMap.get(score.getMonitor_user_id());
-        	sb.setCheck_all_m_score(sb.getCheck_all_m_score()+(score.getCheck_item_score()==null?0:score.getCheck_item_score()));
-        	sb.setChecked_m_num(sb.getChecked_m_num()+1);
+
+
+            if (score.getCheck_item_score() != null && ((score.getChecked_person1()==null && score.getChecked_person().intValue() != score.getMonitor_user_id().intValue())
+                    ||(score.getChecked_person1()!=null && score.getChecked_person1().intValue() !=score.getMonitor_user_id().intValue()))) {
+                sb.setCheck_all_m_score(sb.getCheck_all_m_score() + score.getCheck_item_score());
+            }
+
+            if (((score.getChecked_person1()==null && score.getChecked_person().intValue() != score.getMonitor_user_id().intValue())
+                    ||(score.getChecked_person1()!=null && score.getChecked_person1().intValue() !=score.getMonitor_user_id().intValue())) ) {
+                sb.setChecked_m_num(sb.getChecked_m_num() + 1);
+            }
+//
+//
+//        	sb.setCheck_all_m_score(sb.getCheck_all_m_score()+(score.getCheck_item_score()==null?0:score.getCheck_item_score()));
+//        	sb.setChecked_m_num(sb.getChecked_m_num()+1);
         }
         return masterMap;
     }